Merge pull request #4621 from alexanderkyte/strdup_env
[mono.git] / mono / mini / seq-points.c
index 899544d1c02de3e8c90760af621a74f899d64438..88f732d9fc350b9e8a6e5b8bda942e9670a3b0c9 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * seq-points.c: Sequence Points functions
+/**
+ * \file
+ * Sequence Points functions
  *
  * Authors:
  *   Marcos Henrich (marcos.henrich@xamarin.com)
@@ -14,7 +15,6 @@
 static void
 insert_pred_seq_point (MonoInst *last_seq_ins, MonoInst *ins, GSList **next)
 {
-       MonoBasicBlock *in_bb;
        GSList *l;
        int src_index = last_seq_ins->backend.size;
        int dst_index = ins->backend.size;
@@ -64,7 +64,7 @@ recursively_make_pred_seq_points (MonoCompile *cfg, MonoBasicBlock *bb)
                for (int i=0; i < in_bb->num_pred_seq_points; i++) {
                        if (!g_hash_table_lookup (seen, in_bb->pred_seq_points [i])) {
                                g_array_append_val (predecessors, in_bb->pred_seq_points [i]);
-                               g_hash_table_insert (seen, in_bb->pred_seq_points [i], &MONO_SEQ_SEEN_LOOP);
+                               g_hash_table_insert (seen, in_bb->pred_seq_points [i], (gpointer)&MONO_SEQ_SEEN_LOOP);
                        }
                }
                // predecessors = g_array_append_vals (predecessors, in_bb->pred_seq_points, in_bb->num_pred_seq_points);
@@ -81,7 +81,7 @@ recursively_make_pred_seq_points (MonoCompile *cfg, MonoBasicBlock *bb)
                }
        } 
 
-       g_free (predecessors);
+       g_array_free (predecessors, TRUE);
 }
 
 static void
@@ -169,7 +169,7 @@ mono_save_seq_point_info (MonoCompile *cfg)
                                if (l) {
                                        endfinally_seq_point = (MonoInst *)l->data;
 
-                                       for (bb2 = cfg->bb_entry; bb2; bb2 = bb2->next_bb) {
+                                       for (bb2 = bb->next_bb; bb2; bb2 = bb2->next_bb) {
                                                GSList *l = g_slist_last (bb2->seq_points);
 
                                                if (l) {
@@ -224,6 +224,8 @@ mono_save_seq_point_info (MonoCompile *cfg)
                }
        }
 
+       g_free (seq_points);
+
        if (has_debug_data)
                g_free (next);