Re: [PATCH 03/15] read-cache: free cache entry in add_to_index in case of early return

2015-03-22 Thread Junio C Hamano
Stefan Beller sbel...@google.com writes: On Fri, Mar 20, 2015 at 8:31 PM, Junio C Hamano gits...@pobox.com wrote: Stefan Beller sbel...@google.com writes: This frees `ce` would be leaking in the error path. At this point ce is not yet added to the index, so it is clear it is safe to free

[PATCH 03/15] read-cache: free cache entry in add_to_index in case of early return

2015-03-20 Thread Stefan Beller
This frees `ce` would be leaking in the error path. Additionally a free is moved towards the return. This helps code readability as we often have this pattern of freeing resources just before return/exit and not in between the code. Signed-off-by: Stefan Beller sbel...@google.com ---

Re: [PATCH 03/15] read-cache: free cache entry in add_to_index in case of early return

2015-03-20 Thread Junio C Hamano
Stefan Beller sbel...@google.com writes: This frees `ce` would be leaking in the error path. At this point ce is not yet added to the index, so it is clear it is safe to free it---otherwise we will leak it. Good. Additionally a free is moved towards the return. I am on the fence on this one

Re: [PATCH 03/15] read-cache: free cache entry in add_to_index in case of early return

2015-03-20 Thread Stefan Beller
On Fri, Mar 20, 2015 at 8:31 PM, Junio C Hamano gits...@pobox.com wrote: Stefan Beller sbel...@google.com writes: This frees `ce` would be leaking in the error path. At this point ce is not yet added to the index, so it is clear it is safe to free it---otherwise we will leak it. Good.