From 14fd4de5d5f0a4e8e51fc2fc180d5ec4c92fa22c Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Mon, 2 Apr 2018 17:32:29 -0400 Subject: [PATCH] memory leak fix --- parser.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parser.c b/parser.c index 68104f6..691e296 100644 --- a/parser.c +++ b/parser.c @@ -230,13 +230,13 @@ loop: } else { // move result global variable "ANS" variable *ret = igetvar(it, "ANS"); - ret->type = it->ret->type; - if (ret->type == STRING) { + if (ret->type == STRING) free((void *)ret->value.p); + ret->type = it->ret->type; + if (ret->type == STRING) ret->value.p = (uint32_t)strclone((char *)it->ret->value.p); - } else { + else ret->value.p = it->ret->value.p; - } itryfree(it->ret); it->ret = ret; }