1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:07:34 +00:00

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
parent 48eec58bdc
commit 30025dd576

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