958e1b
From 43c5d1b9be611a87ca71b75f5a7e1d4ec3056117 Mon Sep 17 00:00:00 2001
958e1b
From: Max Reitz <mreitz@redhat.com>
958e1b
Date: Tue, 11 Nov 2014 16:27:43 +0100
958e1b
Subject: [PATCH 13/19] qemu-img: fix img_compare() flags error path
958e1b
958e1b
Message-id: <1415723263-31710-1-git-send-email-mreitz@redhat.com>
958e1b
Patchwork-id: 62277
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH v2 5/4] qemu-img: fix img_compare() flags error path
958e1b
Bugzilla: 1138691
958e1b
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
958e1b
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
958e1b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
958e1b
958e1b
From: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
958e1b
If img_compare() fails to parse the cache flags the goto out3 code path
958e1b
will call qemu_progress_end().  Make sure we actually call
958e1b
qemu_progress_init() first.
958e1b
958e1b
Reported-by: Markus Armbruster <armbru@redhat.com>
958e1b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
Reviewed-by: Max Reitz <mreitz@redhat.com>
958e1b
(cherry picked from commit cbda016d94017fad3be1c657f0ad98f88395c12a)
958e1b
958e1b
Signed-off-by: Max Reitz <mreitz@redhat.com>
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
---
958e1b
 qemu-img.c | 6 +++---
958e1b
 1 file changed, 3 insertions(+), 3 deletions(-)
958e1b
958e1b
diff --git a/qemu-img.c b/qemu-img.c
958e1b
index 39d7e05..f14890f 100644
958e1b
--- a/qemu-img.c
958e1b
+++ b/qemu-img.c
958e1b
@@ -983,6 +983,9 @@ static int img_compare(int argc, char **argv)
958e1b
     filename1 = argv[optind++];
958e1b
     filename2 = argv[optind++];
958e1b
 
958e1b
+    /* Initialize before goto out */
958e1b
+    qemu_progress_init(progress, 2.0);
958e1b
+
958e1b
     flags = BDRV_O_FLAGS;
958e1b
     ret = bdrv_parse_cache_flags(cache, &flags);
958e1b
     if (ret < 0) {
958e1b
@@ -991,9 +994,6 @@ static int img_compare(int argc, char **argv)
958e1b
         goto out3;
958e1b
     }
958e1b
 
958e1b
-    /* Initialize before goto out */
958e1b
-    qemu_progress_init(progress, 2.0);
958e1b
-
958e1b
     bs1 = bdrv_new_open("image 1", filename1, fmt1, flags, true, quiet);
958e1b
     if (!bs1) {
958e1b
         error_report("Can't open file %s", filename1);
958e1b
-- 
958e1b
1.8.3.1
958e1b