nnn

mirror of https://github.com/jarun/nnn
Log | Files | Refs | README | LICENSE

commit 2f07ccdf21e705377862e5f9dfa31e1694979ac7
parent 19ead0c61193625b6be7d362e8ef8c952a8a0bdc
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Tue, 18 Nov 2025 18:40:24 +0530

Fix #2091: Double Free bug report

Diffstat:
Msrc/nnn.c | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/nnn.c b/src/nnn.c @@ -4900,10 +4900,8 @@ static bool show_content_in_floating_window(char *content, size_t content_len, e /* Create floating window */ WINDOW *win = newwin(win_height, win_width, start_y, start_x); - if (!win) { - free(content); + if (!win) return FALSE; - } keypad(win, TRUE); /* Enable special keys */ @@ -5120,12 +5118,15 @@ static bool show_stats(char *pathbuf, char *dir) action = SEL_MAX; ret = show_content_in_floating_window(content, content_len, &action, TRUE); + + free(content); + content = NULL; + content_len = 0; + if (!ret) break; - } while (handle_cur_move(action)); - free(content); return ret; }