Fix crash (loadstate on missing file) and memory leak (failed to write screenshot)
This commit is contained in:
parent
fc1ebb2597
commit
e717a16398
|
@ -917,7 +917,7 @@ void FCEUI_LoadState(const char *fname)
|
|||
{
|
||||
FCEUI_MakeBackupMovie(false); //Backup the movie before the contents get altered, but do not display messages
|
||||
}
|
||||
if (!file_exists(fname) && fname != NULL)
|
||||
if (fname != NULL && !file_exists(fname))
|
||||
{
|
||||
loadStateFailed = 1;
|
||||
return; // state doesn't exist; exit cleanly
|
||||
|
|
|
@ -587,6 +587,7 @@ int SaveSnapshot(void)
|
|||
if(!(pp=FCEUD_UTF8fopen(fn,"wb")))
|
||||
{
|
||||
free(fn);
|
||||
free(compmem);
|
||||
return 0;
|
||||
}
|
||||
free(fn);
|
||||
|
@ -681,6 +682,7 @@ int SaveSnapshot(char fileName[512])
|
|||
|
||||
if(!(pp=FCEUD_UTF8fopen(fileName,"wb")))
|
||||
{
|
||||
free(compmem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue