diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2014-03-08 12:17:17 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2014-03-08 12:17:17 +0000 |
| commit | d7c698af8a5c7330a5ba70de0ff70904a661c20e (patch) | |
| tree | 6020293bdb1385b8dcd5c04d250af2fec828b2f0 /qemu-img.c | |
| parent | 6570025e53df25c47486d79cc8d3aea725f1744e (diff) | |
| parent | 4089f7c6a0d91020ca60ce8300784c93dd9ddcbe (diff) | |
| download | focaccia-qemu-d7c698af8a5c7330a5ba70de0ff70904a661c20e.tar.gz focaccia-qemu-d7c698af8a5c7330a5ba70de0ff70904a661c20e.zip | |
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block patches # gpg: Signature made Fri 07 Mar 2014 13:30:04 GMT using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: block: qemu-iotests 085 - live snapshots tests hw/ide/ahci.h: Avoid shifting left into sign bit block: Fix error path segfault in bdrv_open() qemu-iotests: Test a few blockdev-add error cases blockdev: Fix NULL pointer dereference in blockdev-add blockdev: Fail blockdev-add with encrypted images block/raw-win32: Strip "file:" prefix on creation block/raw-win32: Implement bdrv_parse_filename() block/raw-posix: Strip "file:" prefix on creation block/raw-posix: Implement bdrv_parse_filename() block: Keep "filename" option after parsing block: mirror - remove code cruft that has no function block: make bdrv_swap rebuild the bs graph node list field. block: Fix bs->request_alignment assertion for bs->sg=1 iscsi: Use bs->sg for everything else than disks qemu-iotests: Test progress output for conversion qemu-img convert: Fix progress output gluster: Remove unused defines and header include gluster: Change licence to GPLv2+ Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qemu-img.c')
| -rw-r--r-- | qemu-img.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/qemu-img.c b/qemu-img.c index 886db881b3..2e40cc1e69 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1162,9 +1162,6 @@ static int img_convert(int argc, char **argv) Error *local_err = NULL; QemuOpts *sn_opts = NULL; - /* Initialize before goto out */ - qemu_progress_init(progress, 1.0); - fmt = NULL; out_fmt = "raw"; cache = "unsafe"; @@ -1197,17 +1194,17 @@ static int img_convert(int argc, char **argv) error_report("option -e is deprecated, please use \'-o " "encryption\' instead!"); ret = -1; - goto out; + goto fail_getopt; case '6': error_report("option -6 is deprecated, please use \'-o " "compat6\' instead!"); ret = -1; - goto out; + goto fail_getopt; case 'o': if (!is_valid_option_list(optarg)) { error_report("Invalid option list: %s", optarg); ret = -1; - goto out; + goto fail_getopt; } if (!options) { options = g_strdup(optarg); @@ -1227,7 +1224,7 @@ static int img_convert(int argc, char **argv) error_report("Failed in parsing snapshot param '%s'", optarg); ret = -1; - goto out; + goto fail_getopt; } } else { snapshot_name = optarg; @@ -1241,7 +1238,7 @@ static int img_convert(int argc, char **argv) if (sval < 0 || *end) { error_report("Invalid minimum zero buffer size for sparse output specified"); ret = -1; - goto out; + goto fail_getopt; } min_sparse = sval / BDRV_SECTOR_SIZE; @@ -1262,9 +1259,12 @@ static int img_convert(int argc, char **argv) } } + /* Initialize before goto out */ if (quiet) { progress = 0; } + qemu_progress_init(progress, 1.0); + bs_n = argc - optind - 1; out_filename = bs_n >= 1 ? argv[argc - 1] : NULL; @@ -1667,7 +1667,6 @@ out: free_option_parameters(create_options); free_option_parameters(param); qemu_vfree(buf); - g_free(options); if (sn_opts) { qemu_opts_del(sn_opts); } @@ -1682,6 +1681,9 @@ out: } g_free(bs); } +fail_getopt: + g_free(options); + if (ret) { return 1; } |