From 5022f716dcaefdc8b1e6fe45f1ecb8865921d9ec Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Thu, 23 Aug 2012 13:30:30 +0200 Subject: [PATCH] fix: check if parsing a variable initializer failed --- parser.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parser.c b/parser.c index 0773026..657a35f 100644 --- a/parser.c +++ b/parser.c @@ -2509,6 +2509,11 @@ nextvar: ast_value *cval; cexp = parser_expression_leave(parser, true); + if (!cexp) { + ast_value_delete(typevar); + return false; + } + cval = (ast_value*)cexp; if (!ast_istype(cval, ast_value) || !cval->isconst) parseerror(parser, "cannot initialize a global constant variable with a non-constant expression");