summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2016-04-01 00:35:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-04-01 17:32:43 (GMT)
commit6eb6078bf5fd08028b21d80b9062a4aed83a2340 (patch)
treeb0f0ed26151f56a95e3c2b5be9be5c75a5dc5ff3 /wt-status.c
parent344b548475b86f9f95e9fbcd93022f8083918cc7 (diff)
downloadgit-6eb6078bf5fd08028b21d80b9062a4aed83a2340.zip
git-6eb6078bf5fd08028b21d80b9062a4aed83a2340.tar.gz
git-6eb6078bf5fd08028b21d80b9062a4aed83a2340.tar.bz2
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>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/wt-status.c b/wt-status.c
index bba2596..9f4be33 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)