Skip to content

Commit

Permalink
Merge pull request #63 from monikasoni/master
Browse files Browse the repository at this point in the history
Fix mem leak when failure is set
  • Loading branch information
swolchok authored May 16, 2018
2 parents 28808fd + f17c26c commit 9d55a3c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion GraphQLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ namespace graphql {
// Given properly-configured yylex, run the parser and return the
// result.
static std::unique_ptr<ast::Node> doParse(const char **outError, yyscan_t scanner, bool enableSchema) {
Node *outAST;
Node *outAST = NULL;
yy::GraphQLParserImpl parser(enableSchema, &outAST, outError, scanner);
int failure = parser.parse();
if (failure) {
delete outAST;
}
return !failure ? std::unique_ptr<ast::Node>(outAST) : nullptr;
}

Expand Down

0 comments on commit 9d55a3c

Please sign in to comment.