diff --git a/lib/src/wasm/stdlib.c b/lib/src/wasm/stdlib.c index 1e6cf4a0..65f87e90 100644 --- a/lib/src/wasm/stdlib.c +++ b/lib/src/wasm/stdlib.c @@ -60,6 +60,8 @@ void reset_heap(void *new_heap_start) { } void *malloc(size_t size) { + if (size == 0) return NULL; + Region *prev = NULL; Region *curr = free_list; while (curr != NULL) {