diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-08-06 06:59:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-08-06 07:24:16 +0300 |
commit | bc97d7832906318a1185b3fb460b1d8d89020ba0 (patch) | |
tree | 096969472b2a5ad82c56d8f616cd398f47840bdf /source/blender/editors/sculpt_paint | |
parent | 99738fbfdc8b4639d95c796bcc8711bd89c1aaa4 (diff) |
Cleanup: use MEM_SAFE_FREE macro
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_2d.c | 10 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 5 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_dyntopo.c | 10 |
3 files changed, 5 insertions, 20 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 23b90171a1d..a35e248a78c 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -837,10 +837,7 @@ static void brush_painter_2d_refresh_cache(ImagePaintState *s, if (diameter != cache->lastdiameter || (mask_rotation != cache->last_mask_rotation) || renew_maxmask) { - if (cache->tex_mask) { - MEM_freeN(cache->tex_mask); - cache->tex_mask = NULL; - } + MEM_SAFE_FREE(cache->tex_mask); brush_painter_2d_tex_mapping(s, tile->canvas, @@ -862,10 +859,7 @@ static void brush_painter_2d_refresh_cache(ImagePaintState *s, } /* curve mask can only change if the size changes */ - if (cache->curve_mask) { - MEM_freeN(cache->curve_mask); - cache->curve_mask = NULL; - } + MEM_SAFE_FREE(cache->curve_mask); cache->curve_mask = brush_painter_curve_mask_new(painter, diameter, size, pos); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 8264affc465..7bde864e73f 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -6560,10 +6560,7 @@ static void sculpt_update_tex(const Scene *scene, Sculpt *sd, SculptSession *ss) Brush *brush = BKE_paint_brush(&sd->paint); const int radius = BKE_brush_size_get(scene, brush); - if (ss->texcache) { - MEM_freeN(ss->texcache); - ss->texcache = NULL; - } + MEM_SAFE_FREE(ss->texcache); if (ss->tex_pool) { BKE_image_pool_free(ss->tex_pool); diff --git a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c index 87e0ea7f6a9..ae6dcbdbff4 100644 --- a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c +++ b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c @@ -94,15 +94,9 @@ void SCULPT_pbvh_clear(Object *ob) ss->pbvh = NULL; } - if (ss->pmap) { - MEM_freeN(ss->pmap); - ss->pmap = NULL; - } + MEM_SAFE_FREE(ss->pmap); - if (ss->pmap_mem) { - MEM_freeN(ss->pmap_mem); - ss->pmap_mem = NULL; - } + MEM_SAFE_FREE(ss->pmap_mem); BKE_object_free_derived_caches(ob); |