qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] qemu-img: Make sure @sn_opts can be deleted in all error cases
@ 2020-11-02  9:04 Tuguoyi
  2020-11-03  9:34 ` Kevin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: Tuguoyi @ 2020-11-02  9:04 UTC (permalink / raw)
  To: kwolf@redhat.com, mreitz@redhat.com, qemu-block@nongnu.org
  Cc: qemu-devel@nongnu.org

@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(-)

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;
-- 
2.7.4


--
Best regards,
Guoyi


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-03  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-02  9:04 [PATCH] qemu-img: Make sure @sn_opts can be deleted in all error cases Tuguoyi
2020-11-03  9:34 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).