> Could you rework this loop so that "goto out" is always the right things
> to do in case of error? That is the function would always free()
> "pool_path" and "pool_name" regardless of their values, and we only need
> to make sure both are NULL when they are already free. This is to avoid
> having several path in case of error, as this could result in mistake
> later. If there's only one error path, there will be less likely to have
> mistakes. This loop, at the moment, is using three different error
> paths: "goto out", "goto out_err", and no goto followed by a standalone
> goto.
Hi Anthony,
Yes I will rework it and send v6. Thanks for your review.
Cheers,
Luca
>
>> + }
>> + pool_id++;
>> + if (!xs_write(xsh, XBT_NULL, pool_path, pool_name,
>> + strlen(pool_name))) {
>> + fprintf(stderr, "cannot set pool name\n");
>> + rc = 1;
>> + }
>> + free(pool_name);
>> +out_err:
>> + free(pool_path);
>> + if ( rc )
>> + goto out;
>> + }
>> + } while(xcinfo != NULL);
>
> Thanks,
>
> --
> Anthony PERARD
- [PATCH v5 0/6] Boot time cpupools Luca Fancellu
- [PATCH v5 2/6] xen/sched: create public function f... Luca Fancellu
- Re: [PATCH v5 2/6] xen/sched: create public fu... Juergen Gross
- Re: [PATCH v5 2/6] xen/sched: create publi... Luca Fancellu
- [PATCH v5 1/6] tools/cpupools: Give a name to unna... Luca Fancellu
- Re: [PATCH v5 1/6] tools/cpupools: Give a name... Anthony PERARD
- Re: [PATCH v5 1/6] tools/cpupools: Give a ... Luca Fancellu
- [PATCH v5 4/6] xen/cpupool: Create different cpupo... Luca Fancellu
- Re: [PATCH v5 4/6] xen/cpupool: Create differe... Stefano Stabellini
- Re: [PATCH v5 4/6] xen/cpupool: Create differe... Juergen Gross
- Re: [PATCH v5 4/6] xen/cpupool: Create differe... Julien Grall
- Re: [PATCH v5 4/6] xen/cpupool: Create dif... Luca Fancellu
- Re: [PATCH v5 4/6] xen/cpupool: Create... Julien Grall
- [PATCH v5 5/6] arm/dom0less: assign dom0less guest... Luca Fancellu
- [PATCH v5 3/6] xen/sched: retrieve scheduler id by... Luca Fancellu
- [PATCH v5 6/6] xen/cpupool: Allow cpupool0 to use ... Luca Fancellu
- Re: [PATCH v5 6/6] xen/cpupool: Allow cpupool0... Juergen Gross
