Re: [PATCH] commit: fix memory leak in `prepare_index()`

2017-09-20 Thread Jeff King
On Wed, Sep 20, 2017 at 09:47:23PM +0200, Martin Ågren wrote: > Release `pathspec` and the string list `partial`. Makes sense. > When we clear the string list, make sure we do not free the `util` > pointers. That would result in double-freeing, since we set them up as > `item->util = item` in

[PATCH] commit: fix memory leak in `prepare_index()`

2017-09-20 Thread Martin Ågren
Release `pathspec` and the string list `partial`. When we clear the string list, make sure we do not free the `util` pointers. That would result in double-freeing, since we set them up as `item->util = item` in `list_paths()`. Initialize the string list early, so that we can always release it.