summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2015-03-30 18:22:09 -0700
committerJunio C Hamano <gitster@pobox.com>2015-03-30 22:12:38 -0700
commit0e32d4b31f35d36dc78bb26fefac221605ca3e60 (patch)
treeb1a826f5b98b85c97a1b310928e55d368359804c
parente156455ea49124c140a67623f22a393db62d5d98 (diff)
downloadgit-sb/plug-wt-shortstatus-tracking-leak.tar.gz
wt-status.c: fix a memleaksb/plug-wt-shortstatus-tracking-leak
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>
-rw-r--r--wt-status.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/wt-status.c b/wt-status.c
index ec7344e508..3ec4383ae9 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);