From 30025dd57670b49fa9bca130ce34cbd8a68b062d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 21 Jul 2020 16:38:58 +0200 Subject: [PATCH] LibC: Notify UserspaceEmulator about malloc *after* scrubbing This makes sure that the emulator marks new malloc memory as uninitialized (even after we've "initialized" it by scrubbing with the scrub byte.) --- Libraries/LibC/malloc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibC/malloc.cpp b/Libraries/LibC/malloc.cpp index 09b90ce081..552d4d2ed6 100644 --- a/Libraries/LibC/malloc.cpp +++ b/Libraries/LibC/malloc.cpp @@ -295,10 +295,10 @@ static void* malloc_impl(size_t size) dbgprintf("LibC: allocated %p (chunk in block %p, size %zu)\n", ptr, block, block->bytes_per_chunk()); #endif - ue_notify_malloc(ptr, size); - if (s_scrub_malloc) memset(ptr, MALLOC_SCRUB_BYTE, block->m_size); + + ue_notify_malloc(ptr, size); return ptr; }