]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
qemu-img convert: Free @sn_opts in all error cases
authorTuguoyi <tu.guoyi@h3c.com>
Mon, 2 Nov 2020 09:04:57 +0000 (09:04 +0000)
committerKevin Wolf <kwolf@redhat.com>
Tue, 3 Nov 2020 15:24:56 +0000 (16:24 +0100)
@sn_opts is initialized at the beginning, so it should be deleted
after jumping to the lable 'fail_getopt'

Signed-off-by: Guoyi Tu <tu.guoyi@h3c.com>
Message-Id: <6ff1c5d372944494be3932274f75485d@h3c.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-img.c

index a968c74cba3a3bb57c856eebbc11820b96565c9b..c2c56fc797fc0f8b598b96886e465cd48298ff9a 100644 (file)
@@ -2751,7 +2751,6 @@ out:
     qemu_progress_end();
     qemu_opts_del(opts);
     qemu_opts_free(create_opts);
-    qemu_opts_del(sn_opts);
     qobject_unref(open_opts);
     blk_unref(s.target);
     if (s.src) {
@@ -2763,6 +2762,7 @@ out:
     g_free(s.src_sectors);
     g_free(s.src_alignment);
 fail_getopt:
+    qemu_opts_del(sn_opts);
     g_free(options);
 
     return !!ret;