From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1STxRy-0005gw-Mf for qemu-devel@nongnu.org; Mon, 14 May 2012 11:44:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1STxRt-0000FI-ND for qemu-devel@nongnu.org; Mon, 14 May 2012 11:44:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44375) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1STxRt-0000FB-EB for qemu-devel@nongnu.org; Mon, 14 May 2012 11:44:37 -0400 From: Kevin Wolf Date: Mon, 14 May 2012 17:44:17 +0200 Message-Id: <1337010257-9324-4-git-send-email-kwolf@redhat.com> In-Reply-To: <1337010257-9324-1-git-send-email-kwolf@redhat.com> References: <1337010257-9324-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 3/3] qemu-img: Fix segmentation fault List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Charles Arnold The following command generates a segmentation fault. qemu-img convert -O vpc -o ? test test2 This is because the 'goto out;' statement calls qemu_progress_end before qemu_progress_init is called resulting in a NULL pointer invocation. Signed-off-by: Charles Arnold Signed-off-by: Kevin Wolf --- qemu-img.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 5434ddc..c8a70ff 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -712,6 +712,9 @@ static int img_convert(int argc, char **argv) out_filename = argv[argc - 1]; + /* Initialize before goto out */ + qemu_progress_init(progress, 2.0); + if (options && !strcmp(options, "?")) { ret = print_block_option_help(out_filename, out_fmt); goto out; @@ -724,7 +727,6 @@ static int img_convert(int argc, char **argv) goto out; } - qemu_progress_init(progress, 2.0); qemu_progress_print(0, 100); bs = g_malloc0(bs_n * sizeof(BlockDriverState *)); -- 1.7.6.5