[Qemu-devel] [PATCH] qemu-img: Fix leakage of options on error

Fam Zheng posted 1 patch 6 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170515141014.25793-1-famz@redhat.com
Test checkpatch passed
Test docker passed
Test s390x passed
qemu-img.c | 1 +
1 file changed, 1 insertion(+)
[Qemu-devel] [PATCH] qemu-img: Fix leakage of options on error
Posted by Fam Zheng 6 years, 11 months ago
Reported by Coverity.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 qemu-img.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qemu-img.c b/qemu-img.c
index b506839..8b0dfa7 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -294,6 +294,7 @@ static BlockBackend *img_open_opts(const char *optstr,
         if (qdict_haskey(options, BDRV_OPT_FORCE_SHARE)
             && !qdict_get_bool(options, BDRV_OPT_FORCE_SHARE)) {
             error_report("--force-share/-U conflicts with image options");
+            QDECREF(options);
             return NULL;
         }
         qdict_put(options, BDRV_OPT_FORCE_SHARE, qbool_from_bool(true));
-- 
2.9.3


Re: [Qemu-devel] [PATCH] qemu-img: Fix leakage of options on error
Posted by Eric Blake 6 years, 11 months ago
On 05/15/2017 09:10 AM, Fam Zheng wrote:
> Reported by Coverity.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  qemu-img.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Eric Blake <eblake@redhat.com>


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Re: [Qemu-devel] [PATCH] qemu-img: Fix leakage of options on error
Posted by Max Reitz 6 years, 11 months ago
On 2017-05-15 16:10, Fam Zheng wrote:
> Reported by Coverity.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  qemu-img.c | 1 +
>  1 file changed, 1 insertion(+)

Thanks, applied to my block branch:

https://github.com/XanClic/qemu/commits/block

Max