Re: [PATCH] diff-lib: clear `pending` object-array in `index_differs_from()`

2017-09-20 Thread Jeff King
On Thu, Sep 21, 2017 at 05:56:21AM +0200, Martin Ågren wrote: > > Looks good. A similar bug was the exact reason for adding the function > > in 46be82312. I did a grep for 'free.*\.objects' to see if there were > > other cases. > > Ah. I grepped for "pending.objects", but didn't go more general t

Re: [PATCH] diff-lib: clear `pending` object-array in `index_differs_from()`

2017-09-20 Thread Martin Ågren
On 20 September 2017 at 22:02, Jeff King wrote: > On Wed, Sep 20, 2017 at 09:47:24PM +0200, Martin Ågren wrote: > >> Instead of conditionally freeing `rev.pending.objects`, just call >> `object_array_clear()` on `rev.pending`. This means we don't poke as >> much into the implementation, which is a

Re: [PATCH] diff-lib: clear `pending` object-array in `index_differs_from()`

2017-09-20 Thread Jeff King
On Wed, Sep 20, 2017 at 09:47:24PM +0200, Martin Ågren wrote: > Instead of conditionally freeing `rev.pending.objects`, just call > `object_array_clear()` on `rev.pending`. This means we don't poke as > much into the implementation, which is already a good thing, but also > that we free the indivi

[PATCH] diff-lib: clear `pending` object-array in `index_differs_from()`

2017-09-20 Thread Martin Ågren
Instead of conditionally freeing `rev.pending.objects`, just call `object_array_clear()` on `rev.pending`. This means we don't poke as much into the implementation, which is already a good thing, but also that we free the individual entries as well, thereby fixing a memory-leak. Signed-off-by: Mar