From 2b2cb7b7f4f467b67082f79053118df78f48e66e Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky <pfalcon@users.sourceforge.net>
Date: Fri, 24 Jan 2014 16:21:26 +0200
Subject: [PATCH] unix main: Free input line.

Also, readline uses system malloc, so for symmetry, use the same for
non-readline case.
---
 unix/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/unix/main.c b/unix/main.c
index c93610670..681bf2aa2 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -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);
     }
 }
 
-- 
GitLab