diff options
author | Charles Arnold <carnold@suse.com> | 2012-05-11 10:57:54 -0600 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-05-14 17:02:19 +0200 |
commit | fa170c148b12f40e803af5b442d33f16add345a4 (patch) | |
tree | 12da84cef4b15814c22fdc89caa228f94a72b549 | |
parent | c44bfe4637424a8f1b411b72a465951f104c29ea (diff) |
qemu-img: Fix segmentation fault
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 <carnold@suse.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r-- | qemu-img.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/qemu-img.c b/qemu-img.c index 5434ddc5e..c8a70ffc9 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 *)); |