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>
Stefan Beller committed
Mar 30, 2015 at 18:22 UTC
0e32d4b31f35d36dc78bb26fefac221605ca3e60
1 file changed
+1
wt-status.c
+1
@@ -1541,6 +1541,7 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
1541
base = shorten_unambiguous_ref(base, 0);
1542
color_fprintf(s->fp, header_color, "...");
1543
color_fprintf(s->fp, branch_color_remote, "%s", base);
1544
+ free((char *)base);
1545
1546
if (!upstream_is_gone && !num_ours && !num_theirs) {
1547
fputc(s->null_termination ? '\0' : '\n', s->fp);