[TSan] Tackle MonoPerfCounters (#5413)
[mono.git] / mono / mini / seq-points.c
index a0294d7dd462a2db2c3efcfee3057d053844ab27..8af932a245558b85056f158f6729a71f5df00c0f 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * seq-points.c: Sequence Points functions
+/**
+ * \file
+ * Sequence Points functions
  *
  * Authors:
  *   Marcos Henrich (marcos.henrich@xamarin.com)
@@ -223,6 +224,8 @@ mono_save_seq_point_info (MonoCompile *cfg)
                }
        }
 
+       g_free (seq_points);
+
        if (has_debug_data)
                g_free (next);
 
@@ -234,9 +237,11 @@ mono_save_seq_point_info (MonoCompile *cfg)
        // FIXME: dynamic methods
        if (!cfg->compile_aot) {
                mono_domain_lock (domain);
-               // FIXME: How can the lookup succeed ?
+               // FIXME: The lookup can fail if the method is JITted recursively though a type cctor
                if (!g_hash_table_lookup (domain_jit_info (domain)->seq_points, cfg->method_to_register))
                        g_hash_table_insert (domain_jit_info (domain)->seq_points, cfg->method_to_register, cfg->seq_point_info);
+               else
+                       mono_seq_point_info_free (cfg->seq_point_info);
                mono_domain_unlock (domain);
        }