Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-08-06 06:59:38 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-08-06 07:24:16 +0300
commitbc97d7832906318a1185b3fb460b1d8d89020ba0 (patch)
tree096969472b2a5ad82c56d8f616cd398f47840bdf /source/blender/editors
parent99738fbfdc8b4639d95c796bcc8711bd89c1aaa4 (diff)
Cleanup: use MEM_SAFE_FREE macro
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c5
-rw-r--r--source/blender/editors/animation/keyframes_general.c10
-rw-r--r--source/blender/editors/armature/meshlaplacian.c5
-rw-r--r--source/blender/editors/curve/editcurve.c10
-rw-r--r--source/blender/editors/gpencil/gpencil_convert.c10
-rw-r--r--source/blender/editors/gpencil/gpencil_sculpt_paint.c5
-rw-r--r--source/blender/editors/interface/interface_eyedropper_driver.c5
-rw-r--r--source/blender/editors/interface/interface_handlers.c10
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c5
-rw-r--r--source/blender/editors/mesh/mesh_mirror.c5
-rw-r--r--source/blender/editors/physics/particle_edit.c15
-rw-r--r--source/blender/editors/physics/particle_edit_undo.c5
-rw-r--r--source/blender/editors/screen/area.c10
-rw-r--r--source/blender/editors/screen/screen_edit.c10
-rw-r--r--source/blender/editors/screen/screen_ops.c15
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c10
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c5
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_dyntopo.c10
-rw-r--r--source/blender/editors/space_clip/tracking_ops_solve.c5
-rw-r--r--source/blender/editors/space_file/space_file.c5
-rw-r--r--source/blender/editors/space_image/image_ops.c5
-rw-r--r--source/blender/editors/space_info/info_stats.c5
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c5
-rw-r--r--source/blender/editors/space_text/text_draw.c5
-rw-r--r--source/blender/editors/space_text/text_ops.c5
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c5
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c5
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c25
28 files changed, 46 insertions, 174 deletions
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 31552330071..40871fba2be 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -672,10 +672,7 @@ static void fmod_envelope_deletepoint_cb(bContext *UNUSED(C), void *fcm_dv, void
}
else {
/* just free array, since the only vert was deleted */
- if (env->data) {
- MEM_freeN(env->data);
- env->data = NULL;
- }
+ MEM_SAFE_FREE(env->data);
env->totvert = 0;
}
}
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index eb91afa5c84..75ce62d5e27 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -92,10 +92,7 @@ void delete_fcurve_key(FCurve *fcu, int index, bool do_recalc)
fcu->totvert--;
if (fcu->totvert == 0) {
- if (fcu->bezt) {
- MEM_freeN(fcu->bezt);
- }
- fcu->bezt = NULL;
+ MEM_SAFE_FREE(fcu->bezt);
}
/* recalc handles - only if it won't cause problems */
@@ -136,10 +133,7 @@ bool delete_fcurve_keys(FCurve *fcu)
void clear_fcurve_keys(FCurve *fcu)
{
- if (fcu->bezt) {
- MEM_freeN(fcu->bezt);
- }
- fcu->bezt = NULL;
+ MEM_SAFE_FREE(fcu->bezt);
fcu->totvert = 0;
}
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index e362a2e2f40..990e7589d9d 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -307,10 +307,7 @@ static void laplacian_system_construct_end(LaplacianSystem *sys)
MEM_freeN(sys->faces);
sys->faces = NULL;
- if (sys->varea) {
- MEM_freeN(sys->varea);
- sys->varea = NULL;
- }
+ MEM_SAFE_FREE(sys->varea);
BLI_edgehash_free(sys->edgehash, NULL);
sys->edgehash = NULL;
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index e7d97ce343c..c399abfa52d 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1848,10 +1848,7 @@ static void ed_surf_delete_selected(Object *obedit)
nu->pntsv = 1;
SWAP(short, nu->orderu, nu->orderv);
BKE_nurb_order_clamp_u(nu);
- if (nu->knotsv) {
- MEM_freeN(nu->knotsv);
- }
- nu->knotsv = NULL;
+ MEM_SAFE_FREE(nu->knotsv);
}
else {
nu->pntsu = newu;
@@ -4650,10 +4647,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
/* now join the knots */
if (nu1->type == CU_NURBS) {
- if (nu1->knotsu != NULL) {
- MEM_freeN(nu1->knotsu);
- nu1->knotsu = NULL;
- }
+ MEM_SAFE_FREE(nu1->knotsu);
BKE_nurb_knot_calc_u(nu1);
}
diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c
index ee3536c2f3f..a0a58abc02f 100644
--- a/source/blender/editors/gpencil/gpencil_convert.c
+++ b/source/blender/editors/gpencil/gpencil_convert.c
@@ -1588,14 +1588,8 @@ static int gpencil_convert_layer_exec(bContext *C, wmOperator *op)
C, op->reports, gpd, gpl, mode, norm_weights, rad_fac, link_strokes, &gtd);
/* free temp memory */
- if (gtd.dists) {
- MEM_freeN(gtd.dists);
- gtd.dists = NULL;
- }
- if (gtd.times) {
- MEM_freeN(gtd.times);
- gtd.times = NULL;
- }
+ MEM_SAFE_FREE(gtd.dists);
+ MEM_SAFE_FREE(gtd.times);
/* notifiers */
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
index 14caf0c08a7..869254cef3b 100644
--- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c
+++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
@@ -968,10 +968,7 @@ static void gpencil_brush_clone_free(tGP_BrushEditData *gso)
tGPSB_CloneBrushData *data = gso->customdata;
/* free strokes array */
- if (data->new_strokes) {
- MEM_freeN(data->new_strokes);
- data->new_strokes = NULL;
- }
+ MEM_SAFE_FREE(data->new_strokes);
/* free copybuf colormap */
if (data->new_colors) {
diff --git a/source/blender/editors/interface/interface_eyedropper_driver.c b/source/blender/editors/interface/interface_eyedropper_driver.c
index 8762a4819d4..ccf0e727da8 100644
--- a/source/blender/editors/interface/interface_eyedropper_driver.c
+++ b/source/blender/editors/interface/interface_eyedropper_driver.c
@@ -84,10 +84,7 @@ static void driverdropper_exit(bContext *C, wmOperator *op)
{
WM_cursor_modal_restore(CTX_wm_window(C));
- if (op->customdata) {
- MEM_freeN(op->customdata);
- op->customdata = NULL;
- }
+ MEM_SAFE_FREE(op->customdata);
}
static void driverdropper_sample(bContext *C, wmOperator *op, const wmEvent *event)
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index d920ebbe11a..6f2232fabe5 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -3438,10 +3438,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
const bool is_num_but = ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER);
bool no_zero_strip = false;
- if (data->str) {
- MEM_freeN(data->str);
- data->str = NULL;
- }
+ MEM_SAFE_FREE(data->str);
#ifdef USE_DRAG_MULTINUM
/* this can happen from multi-drag */
@@ -8635,10 +8632,7 @@ static void button_activate_exit(
}
/* clean up button */
- if (but->active) {
- MEM_freeN(but->active);
- but->active = NULL;
- }
+ MEM_SAFE_FREE(but->active);
but->flag &= ~(UI_ACTIVE | UI_SELECT);
but->flag |= UI_BUT_LAST_ACTIVE;
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 85c646d689c..c6a8e771362 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -355,10 +355,7 @@ void EDBM_mesh_clear(BMEditMesh *em)
/* free tessellation data */
em->tottri = 0;
- if (em->looptris) {
- MEM_freeN(em->looptris);
- em->looptris = NULL;
- }
+ MEM_SAFE_FREE(em->looptris);
}
void EDBM_mesh_load(Main *bmain, Object *ob)
diff --git a/source/blender/editors/mesh/mesh_mirror.c b/source/blender/editors/mesh/mesh_mirror.c
index 5eb69aab48b..1a3e6a59588 100644
--- a/source/blender/editors/mesh/mesh_mirror.c
+++ b/source/blender/editors/mesh/mesh_mirror.c
@@ -365,10 +365,7 @@ void ED_mesh_mirrtopo_init(BMEditMesh *em,
void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store)
{
- if (mesh_topo_store->index_lookup) {
- MEM_freeN(mesh_topo_store->index_lookup);
- }
- mesh_topo_store->index_lookup = NULL;
+ MEM_SAFE_FREE(mesh_topo_store->index_lookup);
mesh_topo_store->prev_vert_tot = -1;
mesh_topo_store->prev_edge_tot = -1;
}
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 5a629058c81..85883a2d29a 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -2957,10 +2957,7 @@ static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror)
}
edit->points = new_points;
- if (edit->mirror_cache) {
- MEM_freeN(edit->mirror_cache);
- edit->mirror_cache = NULL;
- }
+ MEM_SAFE_FREE(edit->mirror_cache);
if (psys->child) {
MEM_freeN(psys->child);
@@ -3576,10 +3573,7 @@ static void PE_mirror_x(Depsgraph *depsgraph, Scene *scene, Object *ob, int tagg
}
edit->points = new_points;
- if (edit->mirror_cache) {
- MEM_freeN(edit->mirror_cache);
- edit->mirror_cache = NULL;
- }
+ MEM_SAFE_FREE(edit->mirror_cache);
edit->totpoint = psys->totpart = newtotpart;
@@ -4497,10 +4491,7 @@ static int brush_add(const bContext *C, PEData *data, short number)
}
edit->points = new_points;
- if (edit->mirror_cache) {
- MEM_freeN(edit->mirror_cache);
- edit->mirror_cache = NULL;
- }
+ MEM_SAFE_FREE(edit->mirror_cache);
/* create tree for interpolation */
if (pset->flag & PE_INTERPOLATE_ADDED && psys->totpart) {
diff --git a/source/blender/editors/physics/particle_edit_undo.c b/source/blender/editors/physics/particle_edit_undo.c
index 2c7b5c0de6a..601a8385a24 100644
--- a/source/blender/editors/physics/particle_edit_undo.c
+++ b/source/blender/editors/physics/particle_edit_undo.c
@@ -128,10 +128,7 @@ static void undoptcache_to_editcache(PTCacheUndo *undo, PTCacheEdit *edit)
if (edit->points) {
MEM_freeN(edit->points);
}
- if (edit->mirror_cache) {
- MEM_freeN(edit->mirror_cache);
- edit->mirror_cache = NULL;
- }
+ MEM_SAFE_FREE(edit->mirror_cache);
edit->points = MEM_dupallocN(undo->points);
edit->totpoint = undo->totpoint;
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index c351ade9954..e08a4e946f6 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -834,9 +834,8 @@ void ED_area_status_text(ScrArea *area, const char *str)
BLI_strncpy(region->headerstr, str, UI_MAX_DRAW_STR);
BLI_str_rstrip(region->headerstr);
}
- else if (region->headerstr) {
- MEM_freeN(region->headerstr);
- region->headerstr = NULL;
+ else {
+ MEM_SAFE_FREE(region->headerstr);
}
ED_region_tag_redraw(region);
}
@@ -859,9 +858,8 @@ void ED_workspace_status_text(bContext *C, const char *str)
}
BLI_strncpy(workspace->status_text, str, UI_MAX_DRAW_STR);
}
- else if (workspace->status_text) {
- MEM_freeN(workspace->status_text);
- workspace->status_text = NULL;
+ else {
+ MEM_SAFE_FREE(workspace->status_text);
}
/* Redraw status bar. */
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 2a81fcfde8f..506b5a9859d 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -722,10 +722,7 @@ void ED_region_exit(bContext *C, ARegion *region)
WM_event_modal_handler_region_replace(win, region, NULL);
WM_draw_region_free(region, true);
- if (region->headerstr) {
- MEM_freeN(region->headerstr);
- region->headerstr = NULL;
- }
+ MEM_SAFE_FREE(region->headerstr);
if (region->regiontimer) {
WM_event_remove_timer(wm, win, region->regiontimer);
@@ -1653,10 +1650,7 @@ void ED_refresh_viewport_fps(bContext *C)
}
else {
/* playback stopped or shouldn't be running */
- if (scene->fps_info) {
- MEM_freeN(scene->fps_info);
- }
- scene->fps_info = NULL;
+ MEM_SAFE_FREE(scene->fps_info);
}
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index d8cef889a40..e150d7774f9 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1023,10 +1023,7 @@ AZone *ED_area_azones_update(ScrArea *area, const int xy[2])
static void actionzone_exit(wmOperator *op)
{
- if (op->customdata) {
- MEM_freeN(op->customdata);
- }
- op->customdata = NULL;
+ MEM_SAFE_FREE(op->customdata);
G.moving &= ~G_TRANSFORM_WM;
}
@@ -1308,10 +1305,7 @@ static bool area_swap_init(wmOperator *op, const wmEvent *event)
static void area_swap_exit(bContext *C, wmOperator *op)
{
WM_cursor_modal_restore(CTX_wm_window(C));
- if (op->customdata) {
- MEM_freeN(op->customdata);
- }
- op->customdata = NULL;
+ MEM_SAFE_FREE(op->customdata);
}
static void area_swap_cancel(bContext *C, wmOperator *op)
@@ -1892,10 +1886,7 @@ static void area_move_apply(bContext *C, wmOperator *op)
static void area_move_exit(bContext *C, wmOperator *op)
{
- if (op->customdata) {
- MEM_freeN(op->customdata);
- }
- op->customdata = NULL;
+ MEM_SAFE_FREE(op->customdata);
/* this makes sure aligned edges will result in aligned grabbing */
BKE_screen_remove_double_scrverts(CTX_wm_screen(C));
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);
diff --git a/source/blender/editors/space_clip/tracking_ops_solve.c b/source/blender/editors/space_clip/tracking_ops_solve.c
index 96504651e44..58f9b307ef9 100644
--- a/source/blender/editors/space_clip/tracking_ops_solve.c
+++ b/source/blender/editors/space_clip/tracking_ops_solve.c
@@ -299,10 +299,7 @@ static int clear_solution_exec(bContext *C, wmOperator *UNUSED(op))
track->flag &= ~TRACK_HAS_BUNDLE;
}
- if (reconstruction->cameras != NULL) {
- MEM_freeN(reconstruction->cameras);
- reconstruction->cameras = NULL;
- }
+ MEM_SAFE_FREE(reconstruction->cameras);
reconstruction->camnr = 0;
reconstruction->flag &= ~TRACKING_RECONSTRUCTED;
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index d7a6523de26..756fc179e31 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -176,10 +176,7 @@ static void file_free(SpaceLink *sl)
MEM_SAFE_FREE(sfile->asset_params);
MEM_SAFE_FREE(sfile->runtime);
- if (sfile->layout) {
- MEM_freeN(sfile->layout);
- sfile->layout = NULL;
- }
+ MEM_SAFE_FREE(sfile->layout);
}
/* spacetype; init callback, area size changes, screen set, etc */
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index dad354ba8ee..613042a2ab9 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -2508,10 +2508,7 @@ static ImageNewData *image_new_init(bContext *C, wmOperator *op)
static void image_new_free(wmOperator *op)
{
- if (op->customdata) {
- MEM_freeN(op->customdata);
- op->customdata = NULL;
- }
+ MEM_SAFE_FREE(op->customdata);
}
static int image_new_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 983e04127e0..e749e1a7947 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -466,10 +466,7 @@ static void stats_update(Depsgraph *depsgraph,
void ED_info_stats_clear(wmWindowManager *wm, ViewLayer *view_layer)
{
- if (view_layer->stats) {
- MEM_freeN(view_layer->stats);
- view_layer->stats = NULL;
- }
+ MEM_SAFE_FREE(view_layer->stats);
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
ViewLayer *view_layer_test = WM_window_get_active_view_layer(win);
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index b6b3d1841d2..c4575b3403e 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -565,10 +565,7 @@ static void sequencer_add_init(bContext *UNUSED(C), wmOperator *op)
static void sequencer_add_cancel(bContext *UNUSED(C), wmOperator *op)
{
- if (op->customdata) {
- MEM_freeN(op->customdata);
- }
- op->customdata = NULL;
+ MEM_SAFE_FREE(op->customdata);
}
static bool sequencer_add_draw_check_fn(PointerRNA *UNUSED(ptr),
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 1d8bc427212..b6ba95885e4 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -686,10 +686,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *region)
}
}
else {
- if (drawcache->line_height) {
- MEM_freeN(drawcache->line_height);
- drawcache->line_height = NULL;
- }
+ MEM_SAFE_FREE(drawcache->line_height);
if (full_update || drawcache->update_flag) {
nlines = BLI_listbase_count(&txt->lines);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index b98dae0cd57..2b78ecb245d 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -236,10 +236,7 @@ void text_update_line_edited(TextLine *line)
}
/* we just free format here, and let it rebuild during draw */
- if (line->format) {
- MEM_freeN(line->format);
- line->format = NULL;
- }
+ MEM_SAFE_FREE(line->format);
}
void text_update_edited(Text *text)
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 651ae8a3000..b055a0fe947 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -4917,10 +4917,7 @@ static int view3d_clipping_invoke(bContext *C, wmOperator *op, const wmEvent *ev
if (rv3d->rflag & RV3D_CLIPPING) {
rv3d->rflag &= ~RV3D_CLIPPING;
ED_region_tag_redraw(region);
- if (rv3d->clipbb) {
- MEM_freeN(rv3d->clipbb);
- }
- rv3d->clipbb = NULL;
+ MEM_SAFE_FREE(rv3d->clipbb);
return OPERATOR_FINISHED;
}
return WM_gesture_box_invoke(C, op, event);
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index f97403a0919..b4bdeace716 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -3399,10 +3399,7 @@ static void p_chart_lscm_end(PChart *chart)
EIG_linear_solver_delete(chart->u.lscm.context);
}
- if (chart->u.lscm.abf_alpha) {
- MEM_freeN(chart->u.lscm.abf_alpha);
- chart->u.lscm.abf_alpha = NULL;
- }
+ MEM_SAFE_FREE(chart->u.lscm.abf_alpha);
chart->u.lscm.context = NULL;
chart->u.lscm.pin1 = NULL;
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index 1bcd1fad9d6..c5485cc1495 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -265,26 +265,11 @@ static StitchPreviewer *stitch_preview_init(void)
static void stitch_preview_delete(StitchPreviewer *stitch_preview)
{
if (stitch_preview) {
- if (stitch_preview->preview_polys) {
- MEM_freeN(stitch_preview->preview_polys);
- stitch_preview->preview_polys = NULL;
- }
- if (stitch_preview->uvs_per_polygon) {
- MEM_freeN(stitch_preview->uvs_per_polygon);
- stitch_preview->uvs_per_polygon = NULL;
- }
- if (stitch_preview->preview_stitchable) {
- MEM_freeN(stitch_preview->preview_stitchable);
- stitch_preview->preview_stitchable = NULL;
- }
- if (stitch_preview->preview_unstitchable) {
- MEM_freeN(stitch_preview->preview_unstitchable);
- stitch_preview->preview_unstitchable = NULL;
- }
- if (stitch_preview->static_tris) {
- MEM_freeN(stitch_preview->static_tris);
- stitch_preview->static_tris = NULL;
- }
+ MEM_SAFE_FREE(stitch_preview->preview_polys);
+ MEM_SAFE_FREE(stitch_preview->uvs_per_polygon);
+ MEM_SAFE_FREE(stitch_preview->preview_stitchable);
+ MEM_SAFE_FREE(stitch_preview->preview_unstitchable);
+ MEM_SAFE_FREE(stitch_preview->static_tris);
MEM_freeN(stitch_preview);
}
}