From 4c4529b650d0003bfaba8c7f23b9cacbe6256973 Mon Sep 17 00:00:00 2001
From: Leon Styhre <leon@leonstyhre.com>
Date: Tue, 17 Oct 2023 22:42:53 +0200
Subject: [PATCH] Fixed a minor memory leak related to gamelist.xml entries
 where the file extension was no longer configured in es_systems.xml

---
 es-app/src/GamelistFileParser.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/es-app/src/GamelistFileParser.cpp b/es-app/src/GamelistFileParser.cpp
index bcf1a2104..c5b53db03 100644
--- a/es-app/src/GamelistFileParser.cpp
+++ b/es-app/src/GamelistFileParser.cpp
@@ -83,6 +83,9 @@ namespace GamelistFileParser
 #endif
                                     << "\" is present in gamelist.xml but the extension is not "
                                        "configured in es_systems.xml";
+                    // In the unlikely event that this was the only entry in the folder.
+                    if (treeNode->getChildren().empty())
+                        delete treeNode;
                     return nullptr;
                 }