qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Jeff Cody <jcody@redhat.com>,
	jsnow@redhat.com, Markus Armbruster <armbru@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 2/3] qemu-img: fix img_compare() flags error path
Date: Tue, 26 Aug 2014 19:17:55 +0100	[thread overview]
Message-ID: <1409077076-29855-3-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1409077076-29855-1-git-send-email-stefanha@redhat.com>

If img_compare() fails to parse the cache flags the goto out3 code path
will call qemu_progress_end().  Make sure we actually call
qemu_progress_init() first.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 qemu-img.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index dc3adb5..01750b7 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1018,6 +1018,9 @@ static int img_compare(int argc, char **argv)
     filename1 = argv[optind++];
     filename2 = argv[optind++];
 
+    /* Initialize before goto out */
+    qemu_progress_init(progress, 2.0);
+
     flags = BDRV_O_FLAGS;
     ret = bdrv_parse_cache_flags(cache, &flags);
     if (ret < 0) {
@@ -1026,9 +1029,6 @@ static int img_compare(int argc, char **argv)
         goto out3;
     }
 
-    /* Initialize before goto out */
-    qemu_progress_init(progress, 2.0);
-
     bs1 = bdrv_new_open("image 1", filename1, fmt1, flags, true, quiet);
     if (!bs1) {
         error_report("Can't open file %s", filename1);
-- 
1.9.3

  parent reply	other threads:[~2014-08-26 18:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26 18:17 [Qemu-devel] [PATCH 0/3] qemu-img: error path fixes Stefan Hajnoczi
2014-08-26 18:17 ` [Qemu-devel] [PATCH 1/3] qemu-img: fix img_commit() error return value Stefan Hajnoczi
2014-08-26 18:29   ` Max Reitz
2014-08-26 19:31   ` Eric Blake
2014-08-26 20:17     ` John Snow
2014-08-27  6:31       ` Markus Armbruster
2014-08-26 18:17 ` Stefan Hajnoczi [this message]
2014-08-26 18:30   ` [Qemu-devel] [PATCH 2/3] qemu-img: fix img_compare() flags error path Max Reitz
2014-08-26 18:17 ` [Qemu-devel] [PATCH 3/3] qemu-img: always goto out in img_snapshot() error paths Stefan Hajnoczi
2014-08-26 18:32   ` Max Reitz
2014-08-27  6:35   ` Markus Armbruster
2014-08-27 11:17     ` Stefan Hajnoczi
2014-08-26 21:02 ` [Qemu-devel] [PATCH 0/3] qemu-img: error path fixes John Snow
2014-08-27 11:17 ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409077076-29855-3-git-send-email-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).