diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-05-08 15:21:02 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-05-08 15:22:14 +0300 |
commit | 49fe27ee46b4d9272957c21c13365db322ca8396 (patch) | |
tree | 235ed597431d68a62b3d7ac4f77c6599ccd09ba7 /source/blender/modifiers/intern/MOD_surface.c | |
parent | 53580265118236a096257b50f29d354243bdefe3 (diff) |
Modifiers: sanitize/cleanup modifiers' copying & freeing code.
Should also fix T55000: Crash with hooks and curves in Cycles render.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_surface.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_surface.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index bed8f95fb87..353cea80d3f 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -63,20 +63,17 @@ static void freeData(ModifierData *md) if (surmd) { if (surmd->bvhtree) { free_bvhtree_from_mesh(surmd->bvhtree); - MEM_freeN(surmd->bvhtree); + MEM_SAFE_FREE(surmd->bvhtree); } - if (surmd->dm) + if (surmd->dm) { surmd->dm->release(surmd->dm); + surmd->dm = NULL; + } - if (surmd->x) - MEM_freeN(surmd->x); + MEM_SAFE_FREE(surmd->x); - if (surmd->v) - MEM_freeN(surmd->v); - - surmd->bvhtree = NULL; - surmd->dm = NULL; + MEM_SAFE_FREE(surmd->v); } } |