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;
                 }