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:
parent
fd604444eb
commit
cee48d7f73
@ -1341,7 +1341,9 @@ _memory_allocate_oversized(heap_t* heap, size_t size) {
|
|||||||
//! Allocate a block of the given size
|
//! Allocate a block of the given size
|
||||||
static void*
|
static void*
|
||||||
_memory_allocate(heap_t* heap, size_t size) {
|
_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);
|
return _memory_allocate_small(heap, size);
|
||||||
else if (size <= _memory_medium_size_limit)
|
else if (size <= _memory_medium_size_limit)
|
||||||
return _memory_allocate_medium(heap, size);
|
return _memory_allocate_medium(heap, size);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user