From d9b756c5a552c6968791eac5f92cdfda91f696b4 Mon Sep 17 00:00:00 2001 From: dx Date: Wed, 6 May 2020 06:19:10 +0100 Subject: ~free memory in repl --- Converter/src/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Converter') diff --git a/Converter/src/main.c b/Converter/src/main.c index b60e80e..fbcd938 100644 --- a/Converter/src/main.c +++ b/Converter/src/main.c @@ -16,7 +16,9 @@ int main(int argc, char *argv[]) } else { - puts(compile_line(argv[1], strnlen(argv[1], 1024), "")); + string output = (compile_line(argv[1], strnlen(argv[1], 1024), "")); + puts(output); + free(output); } } @@ -27,7 +29,9 @@ int main(int argc, char *argv[]) printf("> "); char *buf = malloc(sizeof(*buf) * 1024); fgets(buf, 1024, stdin); - puts(compile_line(buf, 1024, "")); + string output = (compile_line(buf, 1024, "")); + puts(output); + free(output); } } } -- cgit v1.2.3-13-gbd6f