> 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


Reply via email to