Skip to content

Commit

Permalink
fix memory leak in FileData::Load
Browse files Browse the repository at this point in the history
  • Loading branch information
StillGreen-san authored and RobLoach committed Feb 3, 2025
1 parent 872556d commit 0186631
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/FileData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ class FileData {
GETTER(int, BytesRead, bytesRead)

void Load(const std::string& fileName) { Load(fileName.c_str()); }
void Load(const char* fileName) { data = ::LoadFileData(fileName, &bytesRead); }
void Load(const char* fileName) {
Unload();
data = ::LoadFileData(fileName, &bytesRead);
}

void Unload() {
if (data != nullptr) {
Expand Down

0 comments on commit 0186631

Please sign in to comment.