Skip to content

Commit 2b2cb7b

Browse files
committed
unix main: Free input line.
Also, readline uses system malloc, so for symmetry, use the same for non-readline case.
1 parent 39763c6 commit 2b2cb7b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

unix/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static char *prompt(char *p) {
112112
} else {
113113
l++;
114114
}
115-
char *line = m_new(char, l);
115+
char *line = malloc(l);
116116
memcpy(line, buf, l);
117117
#endif
118118
return line;
@@ -140,6 +140,7 @@ static void do_repl(void) {
140140

141141
mp_lexer_t *lex = mp_lexer_new_from_str_len("<stdin>", line, strlen(line), false);
142142
execute_from_lexer(lex, MP_PARSE_SINGLE_INPUT, true);
143+
free(line);
143144
}
144145
}
145146

0 commit comments

Comments
 (0)