[PATCHv3 4/6] wt-status.c: fix a memleak
- From
Stefan Beller <sbeller@google.com>
- Date
- Mar 31, 2015, 01:22 UTC
- Message-ID
- <1427764931-27745-5-git-send-email-sbeller@google.com>
- In-Reply-To
- <1427764931-27745-1-git-send-email-sbeller@google.com>
In any code path of shorten_unambiguous_ref the return value is a xstrdup(some string), so it is safe to free the variable `base` in any codepath.
Signed-off-by: Stefan Beller <sbeller@google.com> --- wt-status.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/wt-status.c b/wt-status.c index 853419f..38cb165 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1550,6 +1550,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);
-- 2.3.0.81.gc37f363