Skip to content

Commit 0e32d4b

Browse files
stefanbellergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e156455 commit 0e32d4b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

wt-status.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,6 +1541,7 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
15411541
base = shorten_unambiguous_ref(base, 0);
15421542
color_fprintf(s->fp, header_color, "...");
15431543
color_fprintf(s->fp, branch_color_remote, "%s", base);
1544+
free((char *)base);
15441545

15451546
if (!upstream_is_gone && !num_ours && !num_theirs) {
15461547
fputc(s->null_termination ? '\0' : '\n', s->fp);

0 commit comments

Comments
 (0)