Re: [PATCH 4/6] abbrev_sha1_in_line: don't leak memory
- From
Jeff King <peff@peff.net>
- Date
- Mar 30, 2016, 01:11 UTC
- Message-ID
- <20160330011111.GB2237@sigill.intra.peff.net>
- In-Reply-To
- <1459298333-21899-5-git-send-email-sbeller@google.com>
On Tue, Mar 29, 2016 at 05:38:51PM -0700, Stefan Beller wrote:
Show 20 quoted lines
> `split` is of type `struct strbuf **` and just before the new free, > we release the inner strbufs. Make sure to also release the memory > containing the pointers to the individual strbufs. > > Signed-off-by: Stefan Beller <sbeller@google.com> > --- > wt-status.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/wt-status.c b/wt-status.c > index ef74864..a78cfc0 100644 > --- a/wt-status.c > +++ b/wt-status.c > @@ -1065,7 +1065,7 @@ static void abbrev_sha1_in_line(struct strbuf *line) > } > for (i = 0; split[i]; i++) > strbuf_release(split[i]); > - > + free(split); > }
I think this can just combine with the for-loop above to become strbuf_list_free().
-Peff