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

View File

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