]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Merge pull request #180 from xonotic/mem_leak_fix_on_failure_paths
authorDale Weiler <graphitemaster@users.noreply.github.com>
Sun, 26 Nov 2017 22:30:30 +0000 (17:30 -0500)
committerGitHub <noreply@github.com>
Sun, 26 Nov 2017 22:30:30 +0000 (17:30 -0500)
two small memory leak fixes on failure paths

ir.cpp
parser.cpp

diff --git a/ir.cpp b/ir.cpp
index d94558e156a4a4f91a3332bdca215b52017a6db0..facbc33fccaeaaf9829a4fcf72fd18a2e409f6d7 100644 (file)
--- a/ir.cpp
+++ b/ir.cpp
@@ -1474,6 +1474,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;
     }
     self->m_instr.push_back(in);
index 0560849e35719956c4f8f6c86bf05fdf319461a9..ddde65469ec77e7cb596e58451dc88096c5ad8f1 100644 (file)
@@ -3159,6 +3159,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;