From 9ceeabda3893c2938e9e36599b3628ab2448f1d6 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 7 Feb 2018 19:27:50 +0100 Subject: [PATCH] memory: avoid a leak when toggling from Search to Goto This fixes https://savannah.gnu.org/bugs/?53088. --- src/prompt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/prompt.c b/src/prompt.c index 0b73c40b..025fd203 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -615,7 +615,8 @@ int do_prompt(bool allow_tabs, bool allow_files, bottombars(menu); - answer = mallocstrcpy(answer, curranswer); + if (answer != curranswer) + answer = mallocstrcpy(answer, curranswer); #ifndef NANO_TINY redo_theprompt: