Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / metadata / seq-points-data.c
index b8b1bcdb6f45dc7115067857bf3362efe2c8cd13..7adbfe9f7c6dcf6dd8c607190f79e936b8302bb4 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * seq-points-data.c: Sequence Points functions
+/**
+ * \file
+ * Sequence Points functions
  *
  * Authors:
  *   Marcos Henrich (marcos.henrich@xamarin.com)
@@ -372,7 +373,7 @@ mono_seq_point_data_init (SeqPointData *data, int entry_capacity)
 {
        data->entry_count = 0;
        data->entry_capacity = entry_capacity;
-       data->entries = g_malloc (sizeof (SeqPointDataEntry) * entry_capacity);
+       data->entries = (SeqPointDataEntry *)g_malloc (sizeof (SeqPointDataEntry) * entry_capacity);
 }
 
 void
@@ -402,7 +403,7 @@ mono_seq_point_data_read (SeqPointData *data, char *path)
        fsize = ftell(f);
        fseek(f, 0, SEEK_SET);
 
-       buffer_orig = buffer = g_malloc(fsize + 1);
+       buffer_orig = buffer = (guint8 *)g_malloc (fsize + 1);
        fread(buffer_orig, fsize, 1, f);
        fclose(f);
 
@@ -438,7 +439,7 @@ mono_seq_point_data_write (SeqPointData *data, char *path)
        // Add size of entry_count and native_base_offsets
        size += 4 + data->entry_count * 4;
 
-       buffer_orig = buffer = g_malloc (size);
+       buffer_orig = buffer = (guint8 *)g_malloc (size);
 
        encode_var_int (buffer, &buffer, data->entry_count);
 
@@ -450,6 +451,7 @@ mono_seq_point_data_write (SeqPointData *data, char *path)
 
        fwrite (buffer_orig, 1, buffer - buffer_orig, f);
        g_free (buffer_orig);
+       fclose (f);
 
        return TRUE;
 }