Skip to content

Commit

Permalink
wt-status.c: fix a memleak
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stefan Beller authored and Junio C Hamano committed Mar 31, 2015
1 parent e156455 commit 0e32d4b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions wt-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0e32d4b

Please sign in to comment.