mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-15 23:40:29 +02:00
Cleanup errors in sceHeapFreeHeapMemory().
This commit is contained in:
1 parent
df285cec64
commit
9388dd092f
1 file changed
+8
-5
@@ -79,18 +79,21 @@ int sceHeapReallocHeapMemoryWithOption(u32 heapPtr, u32 memPtr, int memSize, u32
|
||||
}
|
||||
|
||||
int sceHeapFreeHeapMemory(u32 heapAddr, u32 memAddr) {
|
||||
if (!Memory::IsValidAddress(memAddr))
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_ADDR;
|
||||
Heap *heap = getHeap(heapAddr);
|
||||
if (!heap) {
|
||||
ERROR_LOG(HLE, "sceHeapFreeHeapMemory(%08x, %08x): invalid heap", heapAddr, memAddr);
|
||||
return SCE_KERNEL_ERROR_INVALID_ID;
|
||||
}
|
||||
|
||||
if(!heap->alloc.FreeExact(memAddr))
|
||||
return SCE_KERNEL_ERROR_INVALID_POINTER;
|
||||
DEBUG_LOG(HLE, "sceHeapFreeHeapMemory(%08x, %08x)", heapAddr, memAddr);
|
||||
// An invalid address will crash the PSP, but 0 is always returns success.
|
||||
if (memAddr == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEBUG_LOG(HLE,"sceHeapFreeHeapMemory(%08x, %08x)", heapAddr, memAddr);
|
||||
if (!heap->alloc.FreeExact(memAddr)) {
|
||||
return SCE_KERNEL_ERROR_INVALID_POINTER;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user