Fixed memory leak. And added braces to match the rest of the switch statement in FileIO.

This commit is contained in:
Matthew Parlane 2012-03-19 17:55:46 +13:00
parent d6d52920ec
commit 418f46ea72
2 changed files with 10 additions and 1 deletions

View File

@ -390,8 +390,14 @@ void ExecuteCommand(u32 _Address)
INFO_LOG(WII_IPC_FILEIO, "IOP: Open File (Device=%s, ID=%08x, Mode=%i)", INFO_LOG(WII_IPC_FILEIO, "IOP: Open File (Device=%s, ID=%08x, Mode=%i)",
pDevice->GetDeviceName().c_str(), DeviceID, Mode); pDevice->GetDeviceName().c_str(), DeviceID, Mode);
if (Memory::Read_U32(_Address + 4) == DeviceID) if (Memory::Read_U32(_Address + 4) == DeviceID)
{
g_FdMap[DeviceID] = pDevice; g_FdMap[DeviceID] = pDevice;
} }
else
{
delete pDevice;
}
}
} }
else else

View File

@ -157,18 +157,21 @@ bool CWII_IPC_HLE_Device_FileIO::OpenFile()
break; break;
} }
case ISFS_OPEN_WRITE: case ISFS_OPEN_WRITE:
{
m_pFileHandle.Open(m_Filename, "r+b"); m_pFileHandle.Open(m_Filename, "r+b");
break; break;
}
case ISFS_OPEN_RW: case ISFS_OPEN_RW:
{ {
m_pFileHandle.Open(m_Filename, "r+b"); m_pFileHandle.Open(m_Filename, "r+b");
break; break;
} }
default: default:
{
PanicAlertT("FileIO: Unknown open mode : 0x%02x", m_Mode); PanicAlertT("FileIO: Unknown open mode : 0x%02x", m_Mode);
break; break;
} }
}
return m_pFileHandle.IsOpen(); return m_pFileHandle.IsOpen();
} }