Fixed a memory leak when processing arcade assets.

This commit is contained in:
Leon Styhre 2021-03-15 21:01:59 +01:00
parent 87cc3e88d2
commit efe1478c0b

View file

@ -112,7 +112,7 @@ void parseGamelist(SystemData* system)
pugi::xml_node root = doc.child("gameList");
if (!root) {
LOG(LogError) << "Could not find <gameList> node in gamelist \"" << xmlpath << "\"";
LOG(LogError) << "Couldn't find <gameList> node in gamelist \"" << xmlpath << "\"";
return;
}
@ -147,7 +147,7 @@ void parseGamelist(SystemData* system)
FileData* file = findOrCreateFile(system, path, type);
if (!file) {
LOG(LogError) << "Could not find or create \"" << path << "\", skipping entry";
LOG(LogError) << "Couldn't find or create \"" << path << "\", skipping entry";
continue;
}
else if (!file->isArcadeAsset()) {
@ -160,6 +160,14 @@ void parseGamelist(SystemData* system)
file->metadata.resetChangedFlag();
}
else {
// Skip arcade asset entries as these will not be used in any way inside
// the application.
LOG(LogDebug) << "Gamelist::parseGamelist(): Skipping arcade asset \"" <<
file->getName() << "\"";
delete file;
continue;
}
// If the game is flagged as hidden and the option has not been set to show hidden
// games, then delete the entry. This leaves no trace of the entry at all in ES
// but that is fine as the option to show hidden files is defined as requiring an
@ -239,7 +247,7 @@ void updateGamelist(SystemData* system)
root = doc.child("gameList");
if (!root) {
LOG(LogError) << "Could not find <gameList> node in gamelist \"" <<
LOG(LogError) << "Couldn't find <gameList> node in gamelist \"" <<
xmlReadPath << "\"";
return;
}