qemu-img: Fix leakage of options on error
authorFam Zheng <famz@redhat.com>
Mon, 15 May 2017 14:10:14 +0000 (22:10 +0800)
committerMax Reitz <mreitz@redhat.com>
Mon, 29 May 2017 13:39:54 +0000 (15:39 +0200)
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

index 0bf941ba56164d933fbba288b31cebf992328b88..5aef8ef0476ebb07a39225851a9151efad276ac2 100644 (file)
@@ -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));