Re: [PATCH 73/83] builtin/apply: make write_out_results() return -1 on error
On Mon, May 2, 2016 at 7:42 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 13 quoted lines
> On Sun, Apr 24, 2016 at 9:34 AM, Christian Couder
> <christian.couder@gmail.com> wrote:
>> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
>> ---
>> 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'?Show 15 quoted lines
>> 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'.Show 10 quoted lines
>> - /* 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?