MemArena: Fix a memory leak caused by pointer confusion
This code was ported from out_ptr, which was a double-pointer, and wanted to double-check that the proper arena was actually allocated. When I ported it to store the pointer directly in the view regardless of whether out_ptr was non-NULL, I got confused here and instead caused the code to only free the arena if the first byte was non-zero.
This commit is contained in:
parent
204598a082
commit
64540bc60d
|
@ -267,7 +267,7 @@ void MemoryMap_Shutdown(MemoryView *views, int num_views, u32 flags, MemArena *a
|
||||||
for (int i = 0; i < num_views; i++)
|
for (int i = 0; i < num_views; i++)
|
||||||
{
|
{
|
||||||
MemoryView* view = &views[i];
|
MemoryView* view = &views[i];
|
||||||
if (view->mapped_ptr && *(u8*)view->mapped_ptr && !freeset.count(view->mapped_ptr))
|
if (view->mapped_ptr && !freeset.count(view->mapped_ptr))
|
||||||
{
|
{
|
||||||
arena->ReleaseView(view->mapped_ptr, view->size);
|
arena->ReleaseView(view->mapped_ptr, view->size);
|
||||||
freeset.insert(view->mapped_ptr);
|
freeset.insert(view->mapped_ptr);
|
||||||
|
|
Loading…
Reference in New Issue