From 7e807cdd2ff73f45087b56e318dfb6f5117c0ece Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 12 Oct 2021 12:44:23 +0200 Subject: [PATCH] memory: avoid leaking the filename when dottifying it on the minibar This fixes https://savannah.gnu.org/bugs/?61334. Bug existed since version 5.5, since the minibar was introduced. --- src/winio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/winio.c b/src/winio.c index 5f5cad82..2ebbe5f1 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2139,9 +2139,11 @@ void minibar(void) * plus a star when the file has been modified. */ if (COLS > 4) { if (namewidth > COLS - 2) { - thename = display_string(thename, namewidth - COLS + 5, COLS - 5, FALSE, FALSE); + char *shortname = display_string(thename, namewidth - COLS + 5, + COLS - 5, FALSE, FALSE); mvwaddstr(bottomwin, 0, 0, "..."); - waddstr(bottomwin, thename); + waddstr(bottomwin, shortname); + free(shortname); } else mvwaddstr(bottomwin, 0, padding, thename);