mirror of
https://github.com/wiiu-env/wiiload_plugin.git
synced 2024-11-22 10:39:16 +01:00
Improve memory management
This commit is contained in:
parent
2f4d549d19
commit
9c699f53d5
@ -228,7 +228,6 @@ int32_t TcpReceiver::loadToMemory(int32_t clientSocket, uint32_t ipAddress) {
|
|||||||
DEBUG_FUNCTION_LINE("Try to load a rpx");
|
DEBUG_FUNCTION_LINE("Try to load a rpx");
|
||||||
FSUtils::CreateSubfolder(RPX_TEMP_PATH);
|
FSUtils::CreateSubfolder(RPX_TEMP_PATH);
|
||||||
res = FSUtils::saveBufferToFile(RPX_TEMP_FILE, inflatedData, fileSize);
|
res = FSUtils::saveBufferToFile(RPX_TEMP_FILE, inflatedData, fileSize);
|
||||||
free(inflatedData);
|
|
||||||
loadedRPX = true;
|
loadedRPX = true;
|
||||||
} else if (inflatedData[0x7] == 0xCA && inflatedData[0x8] == 0xFE && inflatedData[0x9] == 0xDE && inflatedData[0xA] == 0xAD) {
|
} else if (inflatedData[0x7] == 0xCA && inflatedData[0x8] == 0xFE && inflatedData[0x9] == 0xDE && inflatedData[0xA] == 0xAD) {
|
||||||
auto newContainer = PluginUtils::getPluginForBuffer((char *) inflatedData, fileSize);
|
auto newContainer = PluginUtils::getPluginForBuffer((char *) inflatedData, fileSize);
|
||||||
@ -264,29 +263,27 @@ int32_t TcpReceiver::loadToMemory(int32_t clientSocket, uint32_t ipAddress) {
|
|||||||
SYSRelaunchTitle(NULL, NULL);
|
SYSRelaunchTitle(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(inflatedData);
|
|
||||||
free(loadAddress);
|
free(loadAddress);
|
||||||
|
free(inflatedData);
|
||||||
return fileSize;
|
return fileSize;
|
||||||
} else {
|
} else {
|
||||||
DEBUG_FUNCTION_LINE("Failed to parse plugin");
|
DEBUG_FUNCTION_LINE("Failed to parse plugin");
|
||||||
}
|
}
|
||||||
free(inflatedData);
|
|
||||||
}
|
}
|
||||||
|
free(inflatedData);
|
||||||
} else {
|
} else {
|
||||||
if (loadAddress[0x7] == 0xCA && loadAddress[0x8] == 0xFE) {
|
if (loadAddress[0x7] == 0xCA && loadAddress[0x8] == 0xFE) {
|
||||||
DEBUG_FUNCTION_LINE("Try to load a rpx");
|
DEBUG_FUNCTION_LINE("Try to load a rpx");
|
||||||
FSUtils::CreateSubfolder(RPX_TEMP_PATH);
|
FSUtils::CreateSubfolder(RPX_TEMP_PATH);
|
||||||
res = FSUtils::saveBufferToFile(RPX_TEMP_FILE, loadAddress, fileSize);
|
res = FSUtils::saveBufferToFile(RPX_TEMP_FILE, loadAddress, fileSize);
|
||||||
free(loadAddress);
|
|
||||||
loadedRPX = true;
|
loadedRPX = true;
|
||||||
} else if (loadAddress[0x7] == 0xCA && loadAddress[0x8] == 0xFE && loadAddress[0x9] == 0xDE) {
|
} else if (loadAddress[0x7] == 0xCA && loadAddress[0x8] == 0xFE && loadAddress[0x9] == 0xDE) {
|
||||||
OSFatal("Not implemented yet");
|
OSFatal("Not implemented yet");
|
||||||
free(loadAddress);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(loadAddress);
|
||||||
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
return NOT_ENOUGH_MEMORY;
|
return NOT_ENOUGH_MEMORY;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user