-Fixed potential memory leak(Thanks to Dmitry Krutskih!)
-Quotes are now handled correctly on the command line in the windows port(Thanks to Dmitry Krutskih!)
This commit is contained in:
parent
026bd14902
commit
d81a01b6b4
|
@ -202,7 +202,12 @@ int NDS_LoadROM(const char *filename, int bmtype, u32 bmsize)
|
|||
type = ROM_DSGBA;
|
||||
|
||||
file = reader->Init(filename);
|
||||
if (!file) return -1 ;
|
||||
|
||||
if (!file)
|
||||
{
|
||||
free(noext);
|
||||
return -1;
|
||||
}
|
||||
size = reader->Size(file);
|
||||
|
||||
if(type == ROM_DSGBA)
|
||||
|
@ -226,6 +231,7 @@ int NDS_LoadROM(const char *filename, int bmtype, u32 bmsize)
|
|||
if ((data = (u8*)malloc(mask + 1)) == NULL)
|
||||
{
|
||||
reader->DeInit(file);
|
||||
free(noext);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -255,7 +261,10 @@ int NDS_LoadROM(const char *filename, int bmtype, u32 bmsize)
|
|||
if (strlen(noext)>= strlen(DSGBA_EXTENSTION))
|
||||
strncpy(noext + strlen(noext) - strlen(DSGBA_EXTENSTION), ".sav",strlen(DSGBA_EXTENSTION)+1);
|
||||
else
|
||||
return -1 ;
|
||||
{
|
||||
free(noext);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -263,7 +272,10 @@ int NDS_LoadROM(const char *filename, int bmtype, u32 bmsize)
|
|||
if (strlen(noext)>=4)
|
||||
strncpy(noext + strlen(noext) - 4, ".sav",5);
|
||||
else
|
||||
return -1 ;
|
||||
{
|
||||
free(noext);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
mc_realloc(&MMU.bupmem, bmtype, bmsize);
|
||||
|
|
|
@ -499,7 +499,11 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
|||
SPU_SetVolume(sndvolume);
|
||||
|
||||
runthread = CreateThread(NULL, 0, run, NULL, 0, &threadID);
|
||||
|
||||
|
||||
// Make sure any quotes from lpszArgument are removed
|
||||
if (lpszArgument[0] == '\"')
|
||||
sscanf(lpszArgument, "\"%[^\"]\"", lpszArgument);
|
||||
|
||||
if(LoadROM(lpszArgument))
|
||||
{
|
||||
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
|
||||
|
|
Loading…
Reference in New Issue