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 <sunshine@sunshineco.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Mar 31, 2016 at 17:35 UTC
6eb6078bf5fd08028b21d80b9062a4aed83a2340
1 file changed
+1
-3
wt-status.c
+1
-3
@@ -1063,9 +1063,7 @@ static void abbrev_sha1_in_line(struct strbuf *line)
1063
strbuf_addf(line, "%s", split[i]->buf);
1064
}
1065
}
1066
- for (i = 0; split[i]; i++)
1067
- strbuf_release(split[i]);
1068
-
1066
+ strbuf_list_free(split);
1067
}
1068
1069
static void read_rebase_todolist(const char *fname, struct string_list *lines)