-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;
|
type = ROM_DSGBA;
|
||||||
|
|
||||||
file = reader->Init(filename);
|
file = reader->Init(filename);
|
||||||
if (!file) return -1 ;
|
|
||||||
|
if (!file)
|
||||||
|
{
|
||||||
|
free(noext);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
size = reader->Size(file);
|
size = reader->Size(file);
|
||||||
|
|
||||||
if(type == ROM_DSGBA)
|
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)
|
if ((data = (u8*)malloc(mask + 1)) == NULL)
|
||||||
{
|
{
|
||||||
reader->DeInit(file);
|
reader->DeInit(file);
|
||||||
|
free(noext);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +261,10 @@ int NDS_LoadROM(const char *filename, int bmtype, u32 bmsize)
|
||||||
if (strlen(noext)>= strlen(DSGBA_EXTENSTION))
|
if (strlen(noext)>= strlen(DSGBA_EXTENSTION))
|
||||||
strncpy(noext + strlen(noext) - strlen(DSGBA_EXTENSTION), ".sav",strlen(DSGBA_EXTENSTION)+1);
|
strncpy(noext + strlen(noext) - strlen(DSGBA_EXTENSTION), ".sav",strlen(DSGBA_EXTENSTION)+1);
|
||||||
else
|
else
|
||||||
return -1 ;
|
{
|
||||||
|
free(noext);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -263,7 +272,10 @@ int NDS_LoadROM(const char *filename, int bmtype, u32 bmsize)
|
||||||
if (strlen(noext)>=4)
|
if (strlen(noext)>=4)
|
||||||
strncpy(noext + strlen(noext) - 4, ".sav",5);
|
strncpy(noext + strlen(noext) - 4, ".sav",5);
|
||||||
else
|
else
|
||||||
return -1 ;
|
{
|
||||||
|
free(noext);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mc_realloc(&MMU.bupmem, bmtype, bmsize);
|
mc_realloc(&MMU.bupmem, bmtype, bmsize);
|
||||||
|
|
|
@ -500,6 +500,10 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
|
|
||||||
runthread = CreateThread(NULL, 0, run, NULL, 0, &threadID);
|
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))
|
if(LoadROM(lpszArgument))
|
||||||
{
|
{
|
||||||
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
|
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
|
||||||
|
|
Loading…
Reference in New Issue