[Qemu-devel] [PULL 12/15] qemu-img: Fix leakage of options on error

Kevin Wolf posted 15 patches 7 years, 10 months ago
There is a newer version of this series
[Qemu-devel] [PULL 12/15] qemu-img: Fix leakage of options on error
Posted by Kevin Wolf 7 years, 10 months ago
From: Fam Zheng <famz@redhat.com>

Reported by Coverity.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 20170515141014.25793-1-famz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 qemu-img.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qemu-img.c b/qemu-img.c
index 0bf941b..5aef8ef 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -295,6 +295,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));
-- 
1.8.3.1