[aot] Fix another memory leak.
authorZoltan Varga <vargaz@gmail.com>
Wed, 18 Nov 2015 12:26:28 +0000 (07:26 -0500)
committerZoltan Varga <vargaz@gmail.com>
Wed, 18 Nov 2015 12:26:28 +0000 (07:26 -0500)
mono/mini/aot-runtime.c

index 7774e14a8193cec9c3cd7dab768c87b9a5470a9a..8129bc114e0f17af24460cf8ee1e2bb8d0419a1a 100644 (file)
@@ -3599,8 +3599,6 @@ load_patch_info (MonoAotModule *amodule, MonoMemPool *mp, int n_patches,
 
        p = buf;
 
 
        p = buf;
 
-       patches = mono_mempool_alloc0 (mp, sizeof (MonoJumpInfo) * n_patches);
-
        *got_slots = g_malloc (sizeof (guint32) * n_patches);
        for (pindex = 0; pindex < n_patches; ++pindex) {
                (*got_slots)[pindex] = decode_value (p, &p);
        *got_slots = g_malloc (sizeof (guint32) * n_patches);
        for (pindex = 0; pindex < n_patches; ++pindex) {
                (*got_slots)[pindex] = decode_value (p, &p);
@@ -3971,8 +3969,10 @@ init_llvm_method (MonoAotModule *amodule, guint32 method_index, MonoMethod *meth
                }
 
                patches = load_patch_info (amodule, mp, n_patches, llvm, &got_slots, p, &p);
                }
 
                patches = load_patch_info (amodule, mp, n_patches, llvm, &got_slots, p, &p);
-               if (patches == NULL)
+               if (patches == NULL) {
+                       mono_mempool_destroy (mp);
                        goto cleanup;
                        goto cleanup;
+               }
 
                for (pindex = 0; pindex < n_patches; ++pindex) {
                        MonoJumpInfo *ji = &patches [pindex];
 
                for (pindex = 0; pindex < n_patches; ++pindex) {
                        MonoJumpInfo *ji = &patches [pindex];