Commit cbda016d authored by Stefan Hajnoczi's avatar Stefan Hajnoczi

qemu-img: fix img_compare() flags error path

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: default avatarMarkus Armbruster <armbru@redhat.com>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
parent a3981eb9
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment