From e5bc1c45cec1c2936b34cb49da06147a47a9ff76 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Mon, 23 May 2005 17:19:32 +0000
Subject: [PATCH] oops; free magichistory *properly* when we don't need it
 anymore

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2535 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 src/winio.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index 54b13db6..c02428ef 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2568,15 +2568,17 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
 	wrefresh(bottomwin);
     }
 
+#ifndef NANO_SMALL
+    /* Free msgichistory if we need to. */
+    if (magichistory != NULL)
+	free(magichistory);
+#endif
+
     /* We finished putting in an answer or ran a normal shortcut's
-     * associated function, so free msgichistory if we need to and reset
-     * statusbar_x. */
+     * associated function, so reset statusbar_x. */
     if (kbinput == NANO_CANCEL_KEY || kbinput == NANO_ENTER_KEY ||
-	ran_func) {
-	if (magichistory != NULL)
-	    free(magichistory);
+	ran_func)
 	statusbar_x = (size_t)-1;
-    }
 
     return kbinput;
 }
-- 
GitLab