aboutsummaryrefslogtreecommitdiffstats
path: root/clox/src/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'clox/src/memory.c')
-rw-r--r--clox/src/memory.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/clox/src/memory.c b/clox/src/memory.c
index 169d846..8f8fd4a 100644
--- a/clox/src/memory.c
+++ b/clox/src/memory.c
@@ -17,6 +17,12 @@ void *reallocate(void *pointer, size_t oldSize, size_t newSize) {
static void freeObject(Obj *object) {
switch (object->type) {
+ case OBJ_FUNCTION: {
+ ObjFunction *function = (ObjFunction *)object;
+ freeChunk(&function->chunk);
+ FREE(ObjFunction, object);
+ break;
+ }
case OBJ_STRING: {
ObjString *string = (ObjString *)object;
FREE_ARRAY(char, string->chars, string->length + 1);