summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2015-03-31 01:22:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-03-31 05:12:38 (GMT)
commit0e32d4b31f35d36dc78bb26fefac221605ca3e60 (patch)
treeb1a826f5b98b85c97a1b310928e55d368359804c /wt-status.c
parente156455ea49124c140a67623f22a393db62d5d98 (diff)
downloadgit-0e32d4b31f35d36dc78bb26fefac221605ca3e60.zip
git-0e32d4b31f35d36dc78bb26fefac221605ca3e60.tar.gz
git-0e32d4b31f35d36dc78bb26fefac221605ca3e60.tar.bz2
wt-status.c: fix a memleak
wt_shortstatus_print_tracking() calls shorten_unambiguous_ref(), which returns a newly allocated memory the caller takes ownership of; it is necessary to free `base` when the function is done with it. 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.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/wt-status.c b/wt-status.c
index ec7344e..3ec4383 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1541,6 +1541,7 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
base = shorten_unambiguous_ref(base, 0);
color_fprintf(s->fp, header_color, "...");
color_fprintf(s->fp, branch_color_remote, "%s", base);
+ free((char *)base);
if (!upstream_is_gone && !num_ours && !num_theirs) {
fputc(s->null_termination ? '\0' : '\n', s->fp);