From: Junio C Hamano Date: Thu, 21 Sep 2017 04:11:36 GMT Subject: Re: [PATCH] revision: replace "struct cmdline_pathspec" with argv_array Message-ID: In-Reply-To: <20170920203659.xqy76bg5nfabvbfx@sigill.intra.peff.net> Jeff King writes: > Subject: [PATCH] revision: replace "struct cmdline_pathspec" with argv_array > > We assemble an array of strings in a custom struct, > NULL-terminate the result, and then pass it to > parse_pathspec(). > > But then we never free the array or the individual strings > (nor can we do the latter, as they are heap-allocated when > they come from stdin but not when they come from the > passed-in argv). > > Let's swap this out for an argv_array. It does the same > thing with fewer lines of code, and it's safe to call > argv_array_clear() at the end to avoid a memory leak. > > Reported-by: Martin Ă…gren > Signed-off-by: Jeff King > --- > revision.c | 39 +++++++++++---------------------------- > 1 file changed, 11 insertions(+), 28 deletions(-) Makes sense. Thanks for cleaning up the mess I made.