From bf17e53335689828b0533b32cb4a648e1084e011 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Sun, 21 Feb 2021 21:04:02 -0500 Subject: [PATCH] Fix for mismatched fceu.cpp free()/malloc() error flagged by valgrind. --- src/fceu.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/fceu.cpp b/src/fceu.cpp index ec825762..78a0a7ab 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -120,19 +120,23 @@ char romNameWhenClosingEmulator[2048] = {0}; FCEUGI::FCEUGI() : filename(0), - archiveFilename(0) { + archiveFilename(0) +{ //printf("%08x",opsize); // WTF?! } -FCEUGI::~FCEUGI() { - if (filename) { - free(filename); - filename = NULL; - } - if (archiveFilename) { - delete archiveFilename; - archiveFilename = NULL; - } +FCEUGI::~FCEUGI() +{ + if (filename) + { + free(filename); + filename = NULL; + } + if (archiveFilename) + { + free(archiveFilename); + archiveFilename = NULL; + } } bool CheckFileExists(const char* filename) {