From 125384e949e42b82a799f251249f89da47049745 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Mon, 24 Nov 2014 09:09:42 +0100 Subject: [PATCH 4/6] qemu-img: fix img_compare() flags error path Message-id: <1416820184-3129-4-git-send-email-mreitz@redhat.com> Patchwork-id: 62547 O-Subject: [RHEV-7.1 qemu-kvm-rhev PATCH 3/5] qemu-img: fix img_compare() flags error path Bugzilla: 1166481 RH-Acked-by: Markus Armbruster RH-Acked-by: Kevin Wolf RH-Acked-by: Stefan Hajnoczi From: Stefan Hajnoczi 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 Signed-off-by: Stefan Hajnoczi Reviewed-by: Max Reitz (cherry picked from commit cbda016d94017fad3be1c657f0ad98f88395c12a) Signed-off-by: Max Reitz Signed-off-by: Miroslav Rezanina --- qemu-img.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 7a675db..22ef86a 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1014,6 +1014,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) { @@ -1022,9 +1025,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.8.3.1