Another leak

This commit is contained in:
2022-09-05 06:53:53 +01:00
parent 9ce5f6e67e
commit 33302ef318

View File

@@ -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++) {