diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-07-30 08:43:07 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-07-30 08:44:03 +0300 |
commit | 7b8230898e396230efc85750f8de47727be9f6cd (patch) | |
tree | 2a871cebf39587b8c364569ce12d15c1fe32bac7 | |
parent | 5fabcd099b09d67269703ba1864e49df7f55563a (diff) |
Cleanup: safe-free macro for collision modifier
-rw-r--r-- | source/blender/modifiers/intern/MOD_collision.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 931f82c98e9..85901771a96 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -67,30 +67,20 @@ static void freeData(ModifierData *md) CollisionModifierData *collmd = (CollisionModifierData *) md; if (collmd) { - if (collmd->bvhtree) + if (collmd->bvhtree) { BLI_bvhtree_free(collmd->bvhtree); - if (collmd->x) - MEM_freeN(collmd->x); - if (collmd->xnew) - MEM_freeN(collmd->xnew); - if (collmd->current_x) - MEM_freeN(collmd->current_x); - if (collmd->current_xnew) - MEM_freeN(collmd->current_xnew); - if (collmd->current_v) - MEM_freeN(collmd->current_v); - if (collmd->mfaces) - MEM_freeN(collmd->mfaces); - - collmd->x = NULL; - collmd->xnew = NULL; - collmd->current_x = NULL; - collmd->current_xnew = NULL; - collmd->current_v = NULL; + collmd->bvhtree = NULL; + } + + MEM_SAFE_FREE(collmd->x); + MEM_SAFE_FREE(collmd->xnew); + MEM_SAFE_FREE(collmd->current_x); + MEM_SAFE_FREE(collmd->current_xnew); + MEM_SAFE_FREE(collmd->current_v); + MEM_SAFE_FREE(collmd->mfaces); + collmd->time_x = collmd->time_xnew = -1000; collmd->numverts = 0; - collmd->bvhtree = NULL; - collmd->mfaces = NULL; } } |