On Mon, Dec 6, 2010 at 10:20 AM, Jes Sorensen <jes.soren...@redhat.com> wrote: > On 12/06/10 10:32, Stefan Hajnoczi wrote: >> On Mon, Dec 6, 2010 at 8:17 AM, <jes.soren...@redhat.com> wrote: >>> @@ -694,6 +721,11 @@ static int img_convert(int argc, char **argv) >>> >>> out_filename = argv[argc - 1]; >>> >>> + if (options && !strcmp(options, "?")) { >>> + ret = print_block_option_help(out_filename, out_fmt); >>> + goto out2; >>> + } >>> + >>> if (bs_n > 1 && out_baseimg) { >>> error("-B makes no sense when concatenating multiple input images"); >>> return 1; >> >> Why goto out2 and not just return like the bs > 1 && out_baseimg check? > > It is cleaner, I'd rather convert the bs_n test to do it too.
"out2" tells me nothing and is just indirection for a return. At this point no resources have been acquired and it is simplest to bail out early. The segfault on out is fixed by setting up bs_n and bs[] together instead of doing checks in between (that way we never have bs_n > 0 and bs == NULL). Or by adding a check for bs != NULL to the out cleanup code. Then it would be safe to use out. Stefan