From 1ace811722c04a5d227c88d5f522ce2de0bbad5a Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Wed, 29 Nov 2017 15:32:59 +0100 Subject: [PATCH] rl_uninitialize(): also free old_search from previous i-search Signed-off-by: Joachim Nilsson --- src/editline.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/editline.c b/src/editline.c index 81fe05a..ffd84bd 100644 --- a/src/editline.c +++ b/src/editline.c @@ -104,6 +104,7 @@ static size_t Length = 0; static size_t ScreenCount; static size_t ScreenSize; static char *backspace = "\b"; +static char *old_search = NULL; static int tty_cols = SCREEN_COLS; static int tty_rows = SCREEN_ROWS; @@ -602,7 +603,6 @@ static int substrcmp(const char *text, const char *pat, size_t len) static const char *search_hist(const char *search, const char *(*move)(void)) { - static char *old_search; int len; int pos; int (*match)(const char *s1, const char *s2, size_t n); @@ -1177,6 +1177,10 @@ void rl_uninitialize(void) H.Size = 0; H.Pos = 0; + if (old_search) + free(old_search); + old_search = NULL; + /* Uninitialize the line buffer */ if (rl_line_buffer) free(rl_line_buffer);