diff options
Diffstat (limited to 'clox/src/memory.c')
-rw-r--r-- | clox/src/memory.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clox/src/memory.c b/clox/src/memory.c index 3124bb6..1db1c61 100644 --- a/clox/src/memory.c +++ b/clox/src/memory.c @@ -18,6 +18,8 @@ void *reallocate(void *pointer, size_t oldSize, size_t newSize) { static void freeObject(Obj *object) { switch (object->type) { case OBJ_CLOSURE: { + ObjClosure *closure = (ObjClosure *)object; + FREE_ARRAY(ObjUpvalue *, closure->upvalues, closure->upvalueCount); FREE(ObjClosure, object); break; } @@ -36,6 +38,9 @@ static void freeObject(Obj *object) { FREE(ObjString, object); break; } + case OBJ_UPVALUE: + FREE(ObjUpvalue, object); + break; } } |