aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2019-05-28 21:53:38 +0200
committerMax Reitz <mreitz@redhat.com>2019-06-14 14:16:57 +0200
commitf22356d95524347ff255ae58a96f0f7052018d4e (patch)
treee984ebc9f1ee4c84ca6a22489a6b9bc08d9f72fb /qemu-img.c
parent549fb88045253cb246f900a9db447800313865c4 (diff)
downloadqemu-f22356d95524347ff255ae58a96f0f7052018d4e.zip
qemu-f22356d95524347ff255ae58a96f0f7052018d4e.tar.gz
qemu-f22356d95524347ff255ae58a96f0f7052018d4e.tar.bz2
qemu-img: Fix options leakage in img_rebase()
img_rebase() can leak a QDict in two occasions. Fix it. Coverity: CID 1401416 Fixes: d16699b64671466b42079c45b89127aeea1ca565 Fixes: 330c72957196e0ae382abcaa97ebf4eb9bc8574f Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20190528195338.12376-1-mreitz@redhat.com Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/qemu-img.c b/qemu-img.c
index fd62e3a..da14aea 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -3350,6 +3350,7 @@ static int img_rebase(int argc, char **argv)
out_baseimg,
&local_err);
if (local_err) {
+ qobject_unref(options);
error_reportf_err(local_err,
"Could not resolve backing filename: ");
ret = -1;
@@ -3362,7 +3363,9 @@ static int img_rebase(int argc, char **argv)
*/
prefix_chain_bs = bdrv_find_backing_image(bs, out_real_path);
if (prefix_chain_bs) {
+ qobject_unref(options);
g_free(out_real_path);
+
blk_new_backing = blk_new(qemu_get_aio_context(),
BLK_PERM_CONSISTENT_READ,
BLK_PERM_ALL);