Skip to content

Commit

Permalink
Fix mem leak when failure is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Monika Rathor committed May 16, 2018
1 parent 28808fd commit f17c26c
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 f17c26c

Please sign in to comment.