From ab8ff7370f7ab47d415d260dc02c8c74d66e0d37 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <004171b9879af86d3c14654d0080b5559ee48267.1345545736.git.minovotn@redhat.com> References: <004171b9879af86d3c14654d0080b5559ee48267.1345545736.git.minovotn@redhat.com> From: Kevin Wolf Date: Mon, 13 Aug 2012 08:09:57 +0200 Subject: [PATCH 7/8] qemu-img: Fix segmentation fault RH-Author: Kevin Wolf Message-id: <1344845397-3656-1-git-send-email-kwolf@redhat.com> Patchwork-id: 40764 O-Subject: [RHEL-6.4 qemu-kvm PATCH] qemu-img: Fix segmentation fault Bugzilla: 846954 RH-Acked-by: Miroslav Rezanina RH-Acked-by: Laszlo Ersek RH-Acked-by: Luiz Capitulino From: Charles Arnold Bugzilla: 846954 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 (cherry picked from commit fa170c148b12f40e803af5b442d33f16add345a4) Conflicts: qemu-img.c Signed-off-by: Kevin Wolf --- qemu-img.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Signed-off-by: Michal Novotny --- qemu-img.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 0553b40..844d03b 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -722,6 +722,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; @@ -732,8 +735,7 @@ static int img_convert(int argc, char **argv) ret = -1; goto out; } - - qemu_progress_init(progress, 2.0); + qemu_progress_print(0, 100); bs = qemu_mallocz(bs_n * sizeof(BlockDriverState *)); -- 1.7.11.2