Skip to content

Commit 9c9ef5b

Browse files
committed
In preventPouchInitMemoryLeak, when the memory is already allocated, don't clear it
The memory doesn't need to be cleared here, since pouchInit is already set to clear it.
1 parent 00c2c28 commit 9c9ef5b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ttyd-tools/rel/source/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,15 @@ void *preventPouchInitMemoryLeak(uint32_t heap, uint32_t size)
219219
{
220220
// Check if the memory has already been allocated or not
221221
void *PouchPtr = ttyd::mario_pouch::pouchGetPtr();
222-
if (!PouchPtr)
222+
if (PouchPtr)
223223
{
224-
// The memory has not been allocated, so allocate it
225-
return ttyd::memory::__memAlloc(heap, size);
224+
// The memory has already been allocated
225+
return PouchPtr;
226226
}
227227
else
228228
{
229-
// The memory has already been allocated, so clear it
230-
return clearMemory(PouchPtr, size);
229+
// The memory has not been allocated, so allocate it
230+
return ttyd::memory::__memAlloc(heap, size);
231231
}
232232
}
233233

0 commit comments

Comments
 (0)