YAwn: Fix memory leak
@@ -201,7 +201,11 @@ int addToKeySet (CppKeySet & keySet, CppKey & parent, string const & filename)
parser.parse (nextToken, syntaxError, nullptr, nullptr, &root, &ambiguousOutput);
- if (handleErrors (ambiguousOutput, errorListener, filename, grammar, parent) < 0) return -1;
+ if (handleErrors (ambiguousOutput, errorListener, filename, grammar, parent) < 0)
+ {
+ yaep::free_tree (root, nullptr, nullptr);
+ return -1;
+ }
Listener listener{ parent };
walk (listener, root);
