From 9025da8168e505e2b0e32b89a0d94db935dace93 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Fri, 21 Jan 2022 21:24:26 -0800 Subject: Chapter 24.1 --- clox/src/memory.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clox/src/memory.c') 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); -- cgit v1.2.3-54-g00ecf