Re: [PATCH v3 3/3] unpack_trees_options: free messages when done

2018-05-19 Thread Martin Ågren
On 19 May 2018 at 03:02, Jeff King wrote: > On Fri, May 18, 2018 at 03:30:44PM -0700, Elijah Newren wrote: > >> > would become: >> > >> > msgs[ERROR_WOULD_OVERWRITE] = msgs[ERROR_NOUPTODATE_FILE] = >> > string_list_appendf(>msgs_to_free, msg, cmd, cmd)->string; >> > >> >

Re: [PATCH v3 3/3] unpack_trees_options: free messages when done

2018-05-18 Thread Jeff King
On Fri, May 18, 2018 at 03:30:44PM -0700, Elijah Newren wrote: > > would become: > > > > msgs[ERROR_WOULD_OVERWRITE] = msgs[ERROR_NOUPTODATE_FILE] = > > string_list_appendf(>msgs_to_free, msg, cmd, cmd)->string; > > > > I don't know if that's worth it or not (I suspect that there are

Re: [PATCH v3 3/3] unpack_trees_options: free messages when done

2018-05-18 Thread Elijah Newren
On Fri, May 18, 2018 at 2:33 PM, Jeff King wrote: > On Fri, May 18, 2018 at 11:23:27PM +0200, Martin Ågren wrote: > >> diff --git a/unpack-trees.c b/unpack-trees.c >> index 79fd97074e..60293ff536 100644 >> --- a/unpack-trees.c >> +++ b/unpack-trees.c >> @@ -103,6 +103,8 @@ void

Re: [PATCH v3 3/3] unpack_trees_options: free messages when done

2018-05-18 Thread Jeff King
On Fri, May 18, 2018 at 11:23:27PM +0200, Martin Ågren wrote: > diff --git a/unpack-trees.c b/unpack-trees.c > index 79fd97074e..60293ff536 100644 > --- a/unpack-trees.c > +++ b/unpack-trees.c > @@ -103,6 +103,8 @@ void setup_unpack_trees_porcelain(struct > unpack_trees_options *opts, >

[PATCH v3 3/3] unpack_trees_options: free messages when done

2018-05-18 Thread Martin Ågren
The strings allocated in `setup_unpack_trees_porcelain()` are never freed. Provide a function `clear_unpack_trees_porcelain()` to do so and call it where we use `setup_unpack_trees_porcelain()`. The only non-trivial user is `unpack_trees_start()`, where we should place the new call in