From cee48d7f7329b470695a26d58d3ce28a3c16bfed Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 24 Mar 2022 14:28:59 +0000 Subject: [PATCH] tracy_rpmalloc: let allocating 0 bytes return NULL --- client/tracy_rpmalloc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/tracy_rpmalloc.cpp b/client/tracy_rpmalloc.cpp index fbfd74a0..37aa3150 100644 --- a/client/tracy_rpmalloc.cpp +++ b/client/tracy_rpmalloc.cpp @@ -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);