From d6f368a3f400fea3e89280262a8147e7ce5d855c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 22 Aug 2019 00:59:49 +0200 Subject: Move thread work from compiler/parser to thread_work file, fix use after free bug in multithreaded parser allocator --- src/std/alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/std/alloc.c') diff --git a/src/std/alloc.c b/src/std/alloc.c index d07e94f..44a5105 100644 --- a/src/std/alloc.c +++ b/src/std/alloc.c @@ -15,7 +15,7 @@ int am_malloc(usize size, void **mem) { int am_realloc(void *mem, usize new_size, void **new_mem) { void *new_allocated_data = realloc(mem, new_size); - if(!new_allocated_data) { + if(!new_allocated_data && new_size != 0) { amal_log_error("am_malloc: failed to reallocate memory to size %lu", new_size); return ALLOC_FAIL; } -- cgit v1.2.3