diff mbox series

qemu-img: Make sure @sn_opts can be deleted in all error cases

Message ID 6ff1c5d372944494be3932274f75485d@h3c.com (mailing list archive)
State New, archived
Headers show
Series qemu-img: Make sure @sn_opts can be deleted in all error cases | expand

Commit Message

Tuguoyi Nov. 2, 2020, 9:04 a.m. UTC
@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>
---
 qemu-img.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kevin Wolf Nov. 3, 2020, 9:34 a.m. UTC | #1
Am 02.11.2020 um 10:04 hat Tuguoyi geschrieben:
> @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>

Thanks, applied to the block branch.

Kevin
diff mbox series

Patch

diff --git a/qemu-img.c b/qemu-img.c
index 2103507..229cdf9 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2719,7 +2719,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) {
@@ -2731,6 +2730,7 @@  out:
     g_free(s.src_sectors);
     g_free(s.src_alignment);
 fail_getopt:
+    qemu_opts_del(sn_opts);
     g_free(options);
 
     return !!ret;