Fix for mismatched fceu.cpp free()/malloc() error flagged by valgrind.

This commit is contained in:
mjbudd77 2021-02-21 21:04:02 -05:00
parent 3d2d3cbf26
commit bf17e53335
1 changed files with 14 additions and 10 deletions

View File

@ -120,19 +120,23 @@ char romNameWhenClosingEmulator[2048] = {0};
FCEUGI::FCEUGI() FCEUGI::FCEUGI()
: filename(0), : filename(0),
archiveFilename(0) { archiveFilename(0)
{
//printf("%08x",opsize); // WTF?! //printf("%08x",opsize); // WTF?!
} }
FCEUGI::~FCEUGI() { FCEUGI::~FCEUGI()
if (filename) { {
free(filename); if (filename)
filename = NULL; {
} free(filename);
if (archiveFilename) { filename = NULL;
delete archiveFilename; }
archiveFilename = NULL; if (archiveFilename)
} {
free(archiveFilename);
archiveFilename = NULL;
}
} }
bool CheckFileExists(const char* filename) { bool CheckFileExists(const char* filename) {