Skip to content

Commit 6eb6078

Browse files
stefanbellergitster
authored andcommitted
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>
1 parent 344b548 commit 6eb6078

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

wt-status.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,9 +1063,7 @@ static void abbrev_sha1_in_line(struct strbuf *line)
10631063
strbuf_addf(line, "%s", split[i]->buf);
10641064
}
10651065
}
1066-
for (i = 0; split[i]; i++)
1067-
strbuf_release(split[i]);
1068-
1066+
strbuf_list_free(split);
10691067
}
10701068

10711069
static void read_rebase_todolist(const char *fname, struct string_list *lines)

0 commit comments

Comments
 (0)