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.)
This commit is contained in:
Andreas Kling 2020-07-21 16:38:58 +02:00
commit 30025dd576
Notes: sideshowbarker 2024-07-19 04:41:42 +09:00

View file

@ -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;
}