]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qemu-img: fix img_compare() flags error path
authorStefan Hajnoczi <stefanha@redhat.com>
Tue, 26 Aug 2014 18:17:55 +0000 (19:17 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 29 Aug 2014 09:46:57 +0000 (10:46 +0100)
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>
Reviewed-by: Max Reitz <mreitz@redhat.com>
qemu-img.c

index 863798e54b58d911e00c6d5484da73a65543529a..a761c36e7b9ce1193cb44751ce5f2c78c087bf4e 100644 (file)
@@ -999,6 +999,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) {
@@ -1007,9 +1010,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);