From abb8ff6b5840f1243449fd46b1e560d86fa761fa Mon Sep 17 00:00:00 2001 From: Jacob Date: Sat, 14 Jun 2025 09:23:49 -0400 Subject: [PATCH] Finished garbage collector. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🎉 --- src/ast.c | 2 ++ src/htab.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ast.c b/src/ast.c index 8e63437..bee2777 100644 --- a/src/ast.c +++ b/src/ast.c @@ -190,7 +190,9 @@ void ast_call_data_destroy(ASTCallData* call) { void ast_call_data_destroy_psv(ASTCallData* call) { if (!call) return; + free(call->to); call->to = NULL; + free(call->argv); call->argv = NULL; free(call); } diff --git a/src/htab.c b/src/htab.c index 052ef75..30a420c 100644 --- a/src/htab.c +++ b/src/htab.c @@ -7,7 +7,7 @@ #include HTab* htab_init() { - HTab* htab = malloc(sizeof(HTab)); + HTab* htab = calloc(1, sizeof(HTab)); log_dbgf("HTAB %p", htab); @@ -31,7 +31,6 @@ void* htab_get(HTab* htab, char* key) { void htab_ins(HTab* htab, char* key, void* data) { size_t i = geti(key); - // assert((*htab)[i] == NULL); (*htab)[i] = data; log_dbgf("Inserted something to hash table @ index %lu", i); }