1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

tracy_rpmalloc: let allocating 0 bytes return NULL

This commit is contained in:
Benoit Jacob 2022-03-24 14:28:59 +00:00
parent fd604444eb
commit cee48d7f73

View File

@ -1341,7 +1341,9 @@ _memory_allocate_oversized(heap_t* heap, size_t size) {
//! Allocate a block of the given size
static void*
_memory_allocate(heap_t* heap, size_t size) {
if (EXPECTED(size <= SMALL_SIZE_LIMIT))
if (size == 0)
return nullptr;
else if (EXPECTED(size <= SMALL_SIZE_LIMIT))
return _memory_allocate_small(heap, size);
else if (size <= _memory_medium_size_limit)
return _memory_allocate_medium(heap, size);