fix memory leak in array modifier not freeing editmesh, also use better names for allocs.

This commit is contained in:
2011-09-12 02:44:17 +00:00
parent b82b8b4d05
commit 2fa642b6e9
2 changed files with 4 additions and 3 deletions

View File

@@ -94,7 +94,7 @@
BMEditMesh *BMEdit_Create(BMesh *bm) BMEditMesh *BMEdit_Create(BMesh *bm)
{ {
BMEditMesh *tm = MEM_callocN(sizeof(BMEditMesh), "tm"); BMEditMesh *tm = MEM_callocN(sizeof(BMEditMesh), __func__);
tm->bm = bm; tm->bm = bm;
@@ -105,7 +105,7 @@ BMEditMesh *BMEdit_Create(BMesh *bm)
BMEditMesh *BMEdit_Copy(BMEditMesh *tm) BMEditMesh *BMEdit_Copy(BMEditMesh *tm)
{ {
BMEditMesh *tm2 = MEM_callocN(sizeof(BMEditMesh), "tm2"); BMEditMesh *tm2 = MEM_callocN(sizeof(BMEditMesh), __func__);
*tm2 = *tm; *tm2 = *tm;
tm2->derivedCage = tm2->derivedFinal = NULL; tm2->derivedCage = tm2->derivedFinal = NULL;
@@ -1532,7 +1532,7 @@ static CustomData *bmDm_getFaceDataLayout(DerivedMesh *dm)
DerivedMesh *getEditDerivedBMesh(BMEditMesh *em, Object *UNUSED(ob), DerivedMesh *getEditDerivedBMesh(BMEditMesh *em, Object *UNUSED(ob),
float (*vertexCos)[3]) float (*vertexCos)[3])
{ {
EditDerivedBMesh *bmdm = MEM_callocN(sizeof(*bmdm), "bmdm"); EditDerivedBMesh *bmdm = MEM_callocN(sizeof(*bmdm), __func__);
BMesh *bm = em->bm; BMesh *bm = em->bm;
bmdm->tc = em; bmdm->tc = em;

View File

@@ -480,6 +480,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
cddm = CDDM_from_BMEditMesh(em, NULL, 0); cddm = CDDM_from_BMEditMesh(em, NULL, 0);
BMEdit_Free(em); BMEdit_Free(em);
MEM_freeN(em);
MEM_freeN(indexMap); MEM_freeN(indexMap);
return cddm; return cddm;