[runtime] Always free method header in method_to_ir
authorAlexander Kyte <alexmkyte@fastmail.com>
Thu, 23 Jun 2016 19:07:18 +0000 (15:07 -0400)
committerAlexander Kyte <alkyte@microsoft.com>
Wed, 6 Jul 2016 21:13:30 +0000 (17:13 -0400)
mono/mini/method-to-ir.c

index 78273ea20ded7003986b6263cec58c7ca4ab481d..ef28c27dedde0f938a8146a5998072fec0e8e55f 100644 (file)
@@ -8191,7 +8191,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
        if (!header) {
                mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
                goto exception_exit;
+       } else {
+               cfg->headers_to_free = g_slist_prepend_mempool (cfg->mempool, cfg->headers_to_free, header);
        }
+
        generic_container = mono_method_get_generic_container (method);
        sig = mono_method_signature (method);
        num_args = sig->hasthis + sig->param_count;
@@ -13675,7 +13678,6 @@ mono_error_exit:
        g_slist_free (class_inits);
        mono_basic_block_free (original_bb);
        cfg->dont_inline = g_list_remove (cfg->dont_inline, method);
-       cfg->headers_to_free = g_slist_prepend_mempool (cfg->mempool, cfg->headers_to_free, header);
        if (cfg->exception_type)
                return -1;
        else