From: Dale Weiler Date: Fri, 21 Jun 2013 23:26:49 +0000 (+0000) Subject: Fix more bugs (mostly possible NULL pointer dereferences) X-Git-Tag: v0.3.0~97 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fe296de42f96780b4a3c7c2647775ec3d8a5e59d;p=xonotic%2Fgmqcc.git Fix more bugs (mostly possible NULL pointer dereferences) --- diff --git a/ast.c b/ast.c index 913e852..5c42a30 100644 --- a/ast.c +++ b/ast.c @@ -1563,7 +1563,7 @@ bool ast_global_codegen(ast_value *self, ir_builder *ir, bool isfield) return true; error: /* clean up */ - ir_value_delete(v); + if(v) ir_value_delete(v); return false; } diff --git a/main.c b/main.c index bcd9159..ab9520a 100644 --- a/main.c +++ b/main.c @@ -791,7 +791,7 @@ cleanup: vec_free(ppems); if (!OPTS_OPTION_BOOL(OPTION_PP_ONLY)) - parser_cleanup(parser); + if(parser) parser_cleanup(parser); if (opts_output_free) mem_d(OPTS_OPTION_STR(OPTION_OUTPUT)); if (operators_free) diff --git a/parser.c b/parser.c index 14f7803..6216997 100644 --- a/parser.c +++ b/parser.c @@ -3622,7 +3622,8 @@ static bool parse_goto(parser_t *parser, ast_expression **out) if (!(expression = parse_expression(parser, false, true)) || !(*out = parse_goto_computed(parser, &expression))) { parseerror(parser, "invalid goto expression"); - ast_unref(expression); + if(expression) + ast_unref(expression); return false; }