Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix a memory leak based on Lioncash's patches.
  • Loading branch information
Sonicadvance1 committed Dec 19, 2012
1 parent 16ac780 commit 2db4549
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Source/Core/Common/Src/FileUtil.cpp
Expand Up @@ -299,7 +299,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
ERROR_LOG(COMMON,
"Copy: failed reading from source, %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
return false;
goto bail;
}
}

Expand All @@ -310,13 +310,19 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
ERROR_LOG(COMMON,
"Copy: failed writing to output, %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
return false;
goto bail;
}
}
// close flushs
fclose(input);
fclose(output);
return true;
bail:
if (input)
fclose(input);
if (output)
fclose(output);
return false;
#endif
}

Expand Down

0 comments on commit 2db4549

Please sign in to comment.