Skip to contentSkip to conversation

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

PATCH Applied Tuguoyi 2 participants 2 messages Nov 2, 2020 – Nov 3, 2020

lore
Share & tools
lore

Tuguoyi

author
#0 lore raw

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

@sn_opts is initialized at the beginning, so it should be deleted after jumping to the lable 'fail_getopt'

---
 qemu-img.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-img.c +1 -1
index 2103507..229cdf9 100644
@@ -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;
Signature · 6 lines
2.7.4


--
Best regards,
Guoyi
Applied
#1 lore raw

Am 02.11.2020 um 10:04 hat Tuguoyi geschrieben:

Quoted 4 lines

@sn_opts is initialized at the beginning, so it should be deleted after jumping to the lable 'fail_getopt'

Thanks, applied to the block branch.

Kevin