From: Stefan Beller Date: Fri, 1 Apr 2016 00:35:44 +0000 (-0700) Subject: abbrev_sha1_in_line: don't leak memory X-Git-Tag: v2.8.3~1^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6eb6078bf5fd08028b21d80b9062a4aed83a2340;p=thirdparty%2Fgit.git abbrev_sha1_in_line: don't leak memory `split` is of type `struct strbuf **`, and currently we are leaking split itself as well as each element in split[i]. We have a dedicated free function for `struct strbuf **`, which takes care of freeing all related memory. Helped-by: Eric Sunshine Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- diff --git a/wt-status.c b/wt-status.c index bba25960b4..9f4be333d4 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1063,9 +1063,7 @@ static void abbrev_sha1_in_line(struct strbuf *line) strbuf_addf(line, "%s", split[i]->buf); } } - for (i = 0; split[i]; i++) - strbuf_release(split[i]); - + strbuf_list_free(split); } static void read_rebase_todolist(const char *fname, struct string_list *lines)