From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNP4D-0007I2-Ch for qemu-devel@nongnu.org; Fri, 29 Aug 2014 12:30:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNP47-0002ie-5K for qemu-devel@nongnu.org; Fri, 29 Aug 2014 12:30:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNP46-0002iN-Px for qemu-devel@nongnu.org; Fri, 29 Aug 2014 12:30:19 -0400 From: Stefan Hajnoczi Date: Fri, 29 Aug 2014 17:29:32 +0100 Message-Id: <1409329803-20744-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1409329803-20744-1-git-send-email-stefanha@redhat.com> References: <1409329803-20744-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 04/35] qemu-img: fix img_compare() flags error path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , 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 --- qemu-img.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 863798e..a761c36 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -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); -- 1.9.3