fix memory leak in array modifier not freeing editmesh, also use better names for...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 12 Sep 2011 02:44:17 +0000 (02:44 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 12 Sep 2011 02:44:17 +0000 (02:44 +0000)
source/blender/blenkernel/intern/editderivedbmesh.c
source/blender/modifiers/intern/MOD_array.c

index 17d1854483462d5de50bdbf3ec7c8a6df1fd49df..b8f347b9c1c9a0f7cf7386f958a61b97f9a8dae1 100644 (file)
@@ -94,7 +94,7 @@
 
 BMEditMesh *BMEdit_Create(BMesh *bm)
 {
-       BMEditMesh *tm = MEM_callocN(sizeof(BMEditMesh), "tm");
+       BMEditMesh *tm = MEM_callocN(sizeof(BMEditMesh), __func__);
        
        tm->bm = bm;
 
@@ -105,7 +105,7 @@ BMEditMesh *BMEdit_Create(BMesh *bm)
 
 BMEditMesh *BMEdit_Copy(BMEditMesh *tm)
 {
-       BMEditMesh *tm2 = MEM_callocN(sizeof(BMEditMesh), "tm2");
+       BMEditMesh *tm2 = MEM_callocN(sizeof(BMEditMesh), __func__);
        *tm2 = *tm;
        
        tm2->derivedCage = tm2->derivedFinal = NULL;
@@ -1532,7 +1532,7 @@ static CustomData *bmDm_getFaceDataLayout(DerivedMesh *dm)
 DerivedMesh *getEditDerivedBMesh(BMEditMesh *em, Object *UNUSED(ob),
                                            float (*vertexCos)[3])
 {
-       EditDerivedBMesh *bmdm = MEM_callocN(sizeof(*bmdm), "bmdm");
+       EditDerivedBMesh *bmdm = MEM_callocN(sizeof(*bmdm), __func__);
        BMesh *bm = em->bm;
        
        bmdm->tc = em;
index 1262ccf6196b4c42f4b0b112abafc1d29e62651c..5521b68ad35c30659faa3d6013d1ea4e1dc06217 100644 (file)
@@ -480,6 +480,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
        cddm = CDDM_from_BMEditMesh(em, NULL, 0);
 
        BMEdit_Free(em);
+       MEM_freeN(em);
        MEM_freeN(indexMap);
 
        return cddm;