Fix a few GC bugs.

Adding a to a symbol table can trigger a GC, so we need to make
sure we don't do that while sitting on an unpinned object.
This commit is contained in:
Bob Nystrom
2013-12-30 07:30:50 -08:00
parent c8fe27d6c4
commit 45456733aa
2 changed files with 7 additions and 7 deletions
+2 -4
View File
@@ -324,10 +324,8 @@ static void writeBuffer(WrenVM* vm, Buffer* buffer, uint8_t byte)
static void freeBuffer(WrenVM* vm, Buffer* buffer)
{
wrenReallocate(vm, buffer->bytes, buffer->capacity, 0);
buffer->bytes = NULL;
buffer->capacity = 0;
buffer->length = 0;
wrenReallocate(vm, buffer->bytes, 0, 0);
initBuffer(vm, buffer);
}
// Initializes [compiler].