unix main: Free input line.

Also, readline uses system malloc, so for symmetry, use the same for
non-readline case.
This commit is contained in:
Paul Sokolovsky 2014-01-24 16:21:26 +02:00
parent 39763c6cb0
commit 2b2cb7b7f4

View File

@ -112,7 +112,7 @@ static char *prompt(char *p) {
} else {
l++;
}
char *line = m_new(char, l);
char *line = malloc(l);
memcpy(line, buf, l);
#endif
return line;
@ -140,6 +140,7 @@ static void do_repl(void) {
mp_lexer_t *lex = mp_lexer_new_from_str_len("<stdin>", line, strlen(line), false);
execute_from_lexer(lex, MP_PARSE_SINGLE_INPUT, true);
free(line);
}
}