From 8aa57dd5a87b454ce99a336ed86a6bd4d6f77c1e Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Sat, 23 Oct 2021 20:30:56 +0200 Subject: Add string and symbol types --- src/bytecode/chunk.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/bytecode/chunk.h') diff --git a/src/bytecode/chunk.h b/src/bytecode/chunk.h index 81fc4cc..aafa0ec 100755 --- a/src/bytecode/chunk.h +++ b/src/bytecode/chunk.h @@ -32,6 +32,12 @@ chunk_init(void) { void chunk_free(Chunk *chunk) { array_free(chunk->code); + for (size_t i = 0; i < array_size(chunk->constants); i++) { + Object obj = chunk->constants[i]; + if (IS_STRING(obj) || IS_SYMBOL(obj)) { + array_free(obj.text); + } + } array_free(chunk->constants); array_free(chunk->lines); free(chunk); -- cgit v1.2.1