diff --git a/src/state.cpp b/src/state.cpp index 0de6e636..ef8b5db5 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -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 diff --git a/src/video.cpp b/src/video.cpp index 67c9ba43..de06b33f 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -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; }