Merge pull request #1985 from lioncash/master

Fix a resource leak and possible unintentionally executed code.
This commit is contained in:
Henrik Rydgård 2013-05-30 09:00:36 -07:00
commit 8ca2e30747
2 changed files with 10 additions and 4 deletions

View File

@ -2957,11 +2957,14 @@ void __KernelSwitchContext(Thread *target, const char *reason)
oldUID, oldPC, currentThread, currentMIPS->pc);
}
// No longer waiting.
target->nt.waitType = WAITTYPE_NONE;
target->nt.waitID = 0;
if (target)
{
// No longer waiting.
target->nt.waitType = WAITTYPE_NONE;
target->nt.waitID = 0;
__KernelExecutePendingMipsCalls(target, true);
__KernelExecutePendingMipsCalls(target, true);
}
}
void __KernelChangeThreadState(Thread *thread, ThreadStatus newStatus) {

View File

@ -41,7 +41,10 @@ EmuFileType Identify_File(const char *filename)
size_t readSize = fread(&id,4,1,f);
if(readSize != 1)
{
fclose(f);
return FILETYPE_ERROR;
}
psar_id = 0;
fseek(f, 0x24, SEEK_SET);