Fix for small memory leak in GetBackupFileName(). strdup allocates memory and returns a char pointer to it. However std::string allocates its own memory already. Since FCEU_MakeFName returns a std::string already, there is no reason to use strdup in between the assignment of one std::string to another.
This commit is contained in:
parent
02bf3dbb4d
commit
44c8e15503
|
@ -1103,7 +1103,7 @@ string GetBackupFileName()
|
||||||
string filename;
|
string filename;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
filename = strdup(FCEU_MakeFName(FCEUMKF_STATE,CurrentState,0).c_str()); //Generate normal savestate filename
|
filename = FCEU_MakeFName(FCEUMKF_STATE,CurrentState,0); //Generate normal savestate filename
|
||||||
x = filename.find_last_of("."); //Find last dot
|
x = filename.find_last_of("."); //Find last dot
|
||||||
filename = filename.substr(0,x); //Chop off file extension
|
filename = filename.substr(0,x); //Chop off file extension
|
||||||
filename.append(".bak.fc0"); //add .bak
|
filename.append(".bak.fc0"); //add .bak
|
||||||
|
|
Loading…
Reference in New Issue