mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2026-08-11 12:16:06 -05:00
Fix potential memory leaks
This commit is contained in:
@@ -76,6 +76,7 @@ std::optional<PluginData> PluginDataFactory::load(const std::string &filename, M
|
||||
// reading into a 0x40 aligned buffer increases reading speed.
|
||||
char *data = (char *) memalign(0x40, length);
|
||||
if (!data) {
|
||||
is.close();
|
||||
DEBUG_FUNCTION_LINE("Failed to alloc memory for holding the plugin");
|
||||
return {};
|
||||
}
|
||||
@@ -85,6 +86,7 @@ std::optional<PluginData> PluginDataFactory::load(const std::string &filename, M
|
||||
result.resize(length);
|
||||
memcpy(&result[0], data, length);
|
||||
free(data);
|
||||
is.close();
|
||||
|
||||
DEBUG_FUNCTION_LINE("Loaded file!");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user