[sgen] Fix warning
[mono.git] / mono / metadata / mono-basic-block.c
index 1e683279f519bc8fdadc52899ad40d1af061742e..a62c39868d18bf86f36539b771e5a2d676ec4110 100644 (file)
@@ -519,8 +519,6 @@ mono_basic_block_split (MonoMethod *method, MonoError *error)
        MonoSimpleBasicBlock *bb, *root;
        const unsigned char *start, *end;
        MonoMethodHeader *header = mono_method_get_header (method);
-       start = header->code;
-       end = start + header->code_size;
 
        mono_error_init (error);
 
@@ -529,6 +527,9 @@ mono_basic_block_split (MonoMethod *method, MonoError *error)
                return NULL;
        }
 
+       start = header->code;
+       end = start + header->code_size;
+
        bb = g_new0 (MonoSimpleBasicBlock, 1);
        bb->start = 0;
        bb->end = end - start;
@@ -550,9 +551,11 @@ mono_basic_block_split (MonoMethod *method, MonoError *error)
        dump_bb_list (bb, &root, g_strdup_printf("AFTER LIVENESS %s", mono_method_full_name (method, TRUE)));
 #endif
 
+       mono_metadata_free_mh (header);
        return bb;
 
 fail:
+       mono_metadata_free_mh (header);
        mono_basic_block_free (bb);
        return NULL;
 }
@@ -614,7 +617,7 @@ mono_opcode_value_and_size (const unsigned char **ip, const unsigned char *end,
                g_error ("Invalid opcode %d argument %d max opcode %d\n", i, mono_opcodes [i].argument, MONO_CEE_LAST);
        }
 
-       if (ADD_IS_GREATER_OR_OVF (p, size, end))
+       if (ADDP_IS_GREATER_OR_OVF (p, size, end))
                return -1;
 
        return (p - start) + size;