mirror of
https://github.com/antirez/linenoise.git
synced 2025-11-16 04:24:48 +00:00
Fixed another mem leak
This commit is contained in:
@@ -219,11 +219,10 @@ static int linenoisePrompt(int fd, char *buf, size_t buflen, const char *prompt)
|
||||
if (nread <= 0) return len;
|
||||
switch(c) {
|
||||
case 13: /* enter */
|
||||
history_len--;
|
||||
return len;
|
||||
case 4: /* ctrl-d */
|
||||
history_len--;
|
||||
return (len == 0) ? -1 : (int)len;
|
||||
free(history[history_len]);
|
||||
return (len == 0 && c == 4) ? -1 : (int)len;
|
||||
case 3: /* ctrl-c */
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user