From 33302ef31827a48c9b676a5d11a48fa87f3be459 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Mon, 5 Sep 2022 06:53:53 +0100 Subject: [PATCH] Another leak --- source/interpreter.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/interpreter.c b/source/interpreter.c index 86f9c9c..a4028bf 100644 --- a/source/interpreter.c +++ b/source/interpreter.c @@ -102,6 +102,14 @@ void initInterpreter(Interpreter* interpreter) { } void freeInterpreter(Interpreter* interpreter) { + //BUGFIX: handle scopes/types in the exports + for (int i = 0; i < interpreter->exports->capacity; i++) { + freeLiteral(interpreter->exports->entries[i].key); + freeLiteral(interpreter->exports->entries[i].value); + freeLiteral(interpreter->exportTypes->entries[i].key); + freeLiteral(interpreter->exportTypes->entries[i].value); + } + //BUGFIX: handle scopes of functions, which refer to the parent scope (leaking memory) while(interpreter->scope != NULL) { for (int i = 0; i < interpreter->scope->variables.capacity; i++) {