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

UserspaceEmulator: Reset malloc backtrace on mallocation reuse

If a previously-freed malloc chunk is reused, forget any old backtraces
and save a new malloc backtrace.
This commit is contained in:
Andreas Kling 2020-07-16 20:55:41 +02:00
parent 5f0d24cab2
commit 27aa2e5841

View file

@ -45,6 +45,8 @@ void MallocTracer::target_did_malloc(Badge<SoftCPU>, FlatPtr address, size_t siz
ASSERT(existing_mallocation->freed);
existing_mallocation->size = size;
existing_mallocation->freed = false;
existing_mallocation->malloc_backtrace = Emulator::the().raw_backtrace();
existing_mallocation->free_backtrace.clear();
return;
}
m_mallocations.append({ address, size, false, Emulator::the().raw_backtrace(), Vector<FlatPtr>() });