From 70b7b44e5c67e89f6cb7c1e3cc742083ac678d9a Mon Sep 17 00:00:00 2001 From: Lukas Tenbrink Date: Sat, 22 Nov 2025 17:40:54 +0100 Subject: [PATCH] Only call `GodotProfileAlloc` when the allocation actually happened. --- core/os/memory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/os/memory.cpp b/core/os/memory.cpp index 0ce32ad6807..71d68058da1 100644 --- a/core/os/memory.cpp +++ b/core/os/memory.cpp @@ -110,9 +110,9 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) { } else { mem = malloc(p_bytes + (prepad ? DATA_OFFSET : 0)); } - GodotProfileAlloc(mem, p_bytes + (prepad ? DATA_OFFSET : 0)); ERR_FAIL_NULL_V(mem, nullptr); + GodotProfileAlloc(mem, p_bytes + (prepad ? DATA_OFFSET : 0)); if (prepad) { uint8_t *s8 = (uint8_t *)mem; @@ -180,9 +180,9 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) { } else { GodotProfileFree(mem); mem = (uint8_t *)realloc(mem, p_bytes); - GodotProfileAlloc(mem, p_bytes); ERR_FAIL_COND_V(mem == nullptr && p_bytes > 0, nullptr); + GodotProfileAlloc(mem, p_bytes); return mem; }