Re: [PATCH 73/83] builtin/apply: make write_out_results() return -1 on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 2, 2016 at 7:42 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> On Sun, Apr 24, 2016 at 9:34 AM, Christian Couder
> <christian.couder@xxxxxxxxx> wrote:
>> Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
>> ---
>> diff --git a/builtin/apply.c b/builtin/apply.c
>> @@ -4381,7 +4387,7 @@ static int write_out_results(struct apply_state *state, struct patch *list)
>>                                 errs = 1;
>>                         else {
>>                                 if (write_out_one_result(state, l, phase))
>> -                                       exit(1);
>> +                                       return -1;
>
> Isn't this leaking 'string_list cpath'?

Yes, it is. Will fix.

>>                                 if (phase == 1) {
>>                                         if (write_out_one_reject(state, l))
>>                                                 errs = 1;
>> @@ -4484,11 +4490,16 @@ static int apply_patch(struct apply_state *state,
>>             !state->apply_with_reject)
>>                 return -1;
>>
>> -       if (state->apply && write_out_results(state, list)) {
>> -               if (state->apply_with_reject)
>> +       if (state->apply) {
>> +               int res = write_out_results(state, list);
>> +               if (res < 0)
>>                         return -1;
>
> Mentioned previously: Leaking 'list', 'buf', 'fn_table'.

Yeah, already fixed.

>> -               /* with --3way, we still need to write the index out */
>> -               return 1;
>> +               if (res > 0) {
>> +                       if (state->apply_with_reject)
>> +                               return -1;
>> +                       /* with --3way, we still need to write the index out */
>> +                       return 1;
>
> Not the fault of this patch, but this 'return' in the original code
> was also leaking 'list', 'buf', 'fn_table', right?

Yeah, already fixed.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]