Author: Gianluca Guida <glguida@tlbflush.org>
Date: Wed Mar 8 01:27:27 UTC 2017
Parent: f683464e763f0dc55aa204b18718a0a257259e3e
Log message:
parser: free on exception
1: diff --git a/src/lib/lex.l b/src/lib/lex.l 2: index 38a1484..e854b7b 100644 3: --- a/src/lib/lex.l 4: +++ b/src/lib/lex.l 5: @@ -117,12 +117,18 @@ static void _sexpr_parse(yyscan_t yyscan, struct parse_cb *cb) 6: 7: parser = ParseAlloc(malloc); 8: 9: + lac_on_error({ 10: + ParseFree(parser, free); 11: + yylex_destroy(yyscan); 12: + _throw(); 13: + }); 14: + 15: while((v = yylex(&lr, yyscan)) != -1) { 16: Parse(parser, v, lr, cb); 17: } 18: Parse(parser, ENDPARSE, lr, cb); 19: 20: - /* XXX: ON EXCEPTION, destroy parser and retrow. */ 21: + lac_off_error(); 22: 23: ParseFree(parser, free); 24: yylex_destroy(yyscan);