From 212a2f0dc7f6c21b115d9f659fe769c2dba9337c Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 30 May 2023 18:34:09 -0400 Subject: fix: clear outputbuffer properly --- forth.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/forth.c b/forth.c index 14c285f..3250aa7 100644 --- a/forth.c +++ b/forth.c @@ -90,11 +90,9 @@ char* buffer_eval(int len, char* line) { s = stack_new(); initialised = true; outputline = 0; + outputbuffer = malloc(sizeof(char) * 1024); } - else { - free(outputbuffer); - } - outputbuffer = malloc(sizeof(char) * 1024); + strcpy(outputbuffer, ""); eval(ot, s, len, line); if (outputline) { outputline = 0; -- cgit v1.2.3