fix for memory leak re-binding meshes.

This commit is contained in:
Campbell Barton 2011-06-09 11:19:34 +00:00
parent 75dcc2a7dd
commit 21f5a87999
2 changed files with 10 additions and 2 deletions

@ -1259,16 +1259,22 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
if(mmd->bindcagecos) {
if(mmd->bindweights) MEM_freeN(mmd->bindweights);
if(mmd->bindcagecos) MEM_freeN(mmd->bindcagecos);
if(mmd->dyngrid) MEM_freeN(mmd->dyngrid);
if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
if(mmd->bindinfluences) MEM_freeN(mmd->bindinfluences);
if(mmd->bindoffsets) MEM_freeN(mmd->bindoffsets);
if(mmd->dynverts) MEM_freeN(mmd->dynverts);
mmd->bindweights= NULL;
if(mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */
if(mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */
mmd->bindcagecos= NULL;
mmd->dyngrid= NULL;
mmd->dyninfluences= NULL;
mmd->bindoffsets= NULL;
mmd->dynverts= NULL;
mmd->bindweights= NULL; /* deprecated */
mmd->bindcos= NULL; /* deprecated */
mmd->totvert= 0;
mmd->totcagevert= 0;
mmd->totinfluence= 0;

@ -72,6 +72,8 @@ static void freeData(ModifierData *md)
if(mmd->dyngrid) MEM_freeN(mmd->dyngrid);
if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
if(mmd->dynverts) MEM_freeN(mmd->dynverts);
if(mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */
if(mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */
}
static void copyData(ModifierData *md, ModifierData *target)