From fe79b9ff946afacb0e62d51a82de96cafa0b3313 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 16 Nov 2020 14:48:50 +0100 Subject: [PATCH] LibC: Notify UE at the start of free() instead of at the end This way, if we end up deallocating an entire ChunkedBlock, UE doesn't get confused thinking the freed pointer has never been allocated. --- Libraries/LibC/malloc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibC/malloc.cpp b/Libraries/LibC/malloc.cpp index b1a8a0839a..2ed388e52b 100644 --- a/Libraries/LibC/malloc.cpp +++ b/Libraries/LibC/malloc.cpp @@ -377,8 +377,8 @@ static void free_impl(void* ptr) { if (s_profiling) perf_event(PERF_EVENT_FREE, reinterpret_cast(ptr), 0); - free_impl(ptr); ue_notify_free(ptr); + free_impl(ptr); } void* calloc(size_t count, size_t size)