From: David Carlier Date: Tue, 23 May 2017 20:56:03 +0000 (+0100) Subject: two small memory leak fixes on failure paths X-Git-Tag: xonotic-v0.8.5~29^2~1^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8538658e830e2860799ef25f81983ef60a422cc6;p=xonotic%2Fgmqcc.git two small memory leak fixes on failure paths --- diff --git a/ir.cpp b/ir.cpp index 7ac8477..3a166c7 100644 --- a/ir.cpp +++ b/ir.cpp @@ -1449,6 +1449,7 @@ ir_instr* ir_block_create_call(ir_block *self, lex_ctx_t ctx, const char *label, !ir_instr_op(in, 1, func, false)) { delete in; + delete out; return nullptr; } vec_push(self->m_instr, in); diff --git a/parser.cpp b/parser.cpp index 51f7e1e..7bb2a10 100644 --- a/parser.cpp +++ b/parser.cpp @@ -3127,6 +3127,7 @@ static bool parse_switch_go(parser_t *parser, ast_block *block, ast_expression * } if (!OPTS_FLAG(RELAXED_SWITCH)) { if (!ast_istype(swcase.m_value, ast_value)) { /* || ((ast_value*)swcase.m_value)->m_cvq != CV_CONST) { */ + delete switchnode; parseerror(parser, "case on non-constant values need to be explicitly enabled via -frelaxed-switch"); ast_unref(operand); return false;