fix(lib/wasm): return NULL for 0-sized allocations
Co-authored-by: Amaan Qureshi <contact@amaanq.com>
This commit is contained in:
parent
c4d02a5254
commit
ac39aed7c5
1 changed files with 2 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue