mirror of
				https://github.com/troglobit/editline.git
				synced 2025-10-31 16:28:15 +08:00 
			
		
		
		
	rl_uninitialize(): also free old_search from previous i-search
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
		| @@ -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); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Joachim Nilsson
					Joachim Nilsson