This allows for jumping to 'out:' consistently for error exit.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
if (bs_n > 1 && out_baseimg) {
error("-B makes no sense when concatenating multiple input images");
- return 1;
+ ret = -1;
+ goto out;
}
bs = qemu_mallocz(bs_n * sizeof(BlockDriverState *));
if (out_bs) {
bdrv_delete(out_bs);
}
- for (bs_i = 0; bs_i < bs_n; bs_i++) {
- if (bs[bs_i]) {
- bdrv_delete(bs[bs_i]);
+ if (bs) {
+ for (bs_i = 0; bs_i < bs_n; bs_i++) {
+ if (bs[bs_i]) {
+ bdrv_delete(bs[bs_i]);
+ }
}
+ qemu_free(bs);
}
- qemu_free(bs);
if (ret) {
return 1;
}