rl_uninitialize(): also free old_search from previous i-search

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2017-11-29 15:32:59 +01:00
parent 4b8333ad39
commit 1ace811722

View File

@ -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);