aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavian Kaufmann <flavian@flaviankaufmann.ch>2025-05-25 16:11:13 +0200
committerFlavian Kaufmann <flavian@flaviankaufmann.ch>2025-05-25 16:11:13 +0200
commit49e4ca2fa0c6de8f50d3f739ce46e8d4c7b75da8 (patch)
tree0b605f4ec9bcc7a75c51810b492994ccc33f8064
parentb8f4d07dc762448e50c1d7a2def0b0158b2ebdad (diff)
downloadimp-49e4ca2fa0c6de8f50d3f739ce46e8d4c7b75da8.tar.gz
imp-49e4ca2fa0c6de8f50d3f739ce46e8d4c7b75da8.zip
[bugfix] properly free interpreter context
-rw-r--r--src/interpreter_context.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/interpreter_context.c b/src/interpreter_context.c
index 488f872..b6014d6 100644
--- a/src/interpreter_context.c
+++ b/src/interpreter_context.c
@@ -33,6 +33,13 @@ void imp_interpreter_context_destroy(IMP_InterpreterContext *context) {
ptrdiff_t len = shlen(context->var_table);
for (ptrdiff_t i = 0; i < len; ++i) free((char*)context->var_table[i].key);
shfree(context->var_table);
+ len = shlen(context->proc_table);
+ for (ptrdiff_t i = 0; i < len; ++i) {
+ free((char*)context->proc_table[i].key);
+ imp_ast_destroy((IMP_ASTNode*)context->proc_table[i].value);
+ }
+ shfree(context->proc_table);
+ free(context);
}
int imp_interpreter_context_var_get(IMP_InterpreterContext *context, const char *name) {