two small memory leak fixes on failure paths mem_leak_fix_on_failure_paths
authorDavid Carlier <devnexen@gmail.com>
Tue, 23 May 2017 20:56:03 +0000 (21:56 +0100)
committerDavid Carlier <devnexen@gmail.com>
Tue, 23 May 2017 20:56:03 +0000 (21:56 +0100)
ir.cpp
parser.cpp

diff --git a/ir.cpp b/ir.cpp
index 7ac84773830e0a148b19b1eca21268192e1fac4b..3a166c7af26bf848ec4475370f64052aa0d0846f 100644 (file)
--- 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);
index 51f7e1ea6c571d20b158953b803b306f52f1c35d..7bb2a10f8f2401f783feebed27da3fb12fac980f 100644 (file)
@@ -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;