[Bf-blender-cvs] [03c3136c104] greasepencil-object: Cleanup: use MEM_SAFE_FREE

Antonio Vazquez noreply at git.blender.org
Mon Mar 19 09:56:54 CET 2018


Commit: 03c3136c1041e6c2de788674a3f9b2e80ce9ca35
Author: Antonio Vazquez
Date:   Mon Mar 19 09:56:41 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB03c3136c1041e6c2de788674a3f9b2e80ce9ca35

Cleanup: use  MEM_SAFE_FREE

===================================================================

M	source/blender/draw/engines/gpencil/gpencil_geom.c
M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/editors/gpencil/gpencil_data.c
M	source/blender/editors/gpencil/gpencil_edit.c
M	source/blender/editors/gpencil/gpencil_paint.c

===================================================================

diff --git a/source/blender/draw/engines/gpencil/gpencil_geom.c b/source/blender/draw/engines/gpencil/gpencil_geom.c
index 34be81b080d..254a9cc4f3f 100644
--- a/source/blender/draw/engines/gpencil/gpencil_geom.c
+++ b/source/blender/draw/engines/gpencil/gpencil_geom.c
@@ -558,9 +558,9 @@ static void gp_triangulate_stroke_fill(bGPDstroke *gps)
 	}
 
 	/* clear memory */
-	if (tmp_triangles) MEM_freeN(tmp_triangles);
-	if (points2d) MEM_freeN(points2d);
-	if (uv) MEM_freeN(uv);
+	MEM_SAFE_FREE(tmp_triangles);
+	MEM_SAFE_FREE(points2d);
+	MEM_SAFE_FREE(uv);
 }
 
 /* add a new fill point and texture coordinates to vertex buffer */
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 7bfe9f4350d..bfbf54243b3 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -555,9 +555,9 @@ static void gp_triangulate_stroke_fill(bGPDstroke *gps)
 	}
 
 	/* clear memory */
-	if (tmp_triangles) MEM_freeN(tmp_triangles);
-	if (points2d) MEM_freeN(points2d);
-	if (uv) MEM_freeN(uv);
+	MEM_SAFE_FREE(tmp_triangles);
+	MEM_SAFE_FREE(points2d);
+	MEM_SAFE_FREE(uv);
 }
 
 /* add a new fill point and texture coordinates to vertex buffer */
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 3141a840e4b..e20ed2fb992 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -474,7 +474,7 @@ static int gp_frame_clean_fill_exec(bContext *C, wmOperator *op)
 							BKE_gpencil_free_stroke_weights(gps);
 							MEM_freeN(gps->points);
 						}
-						if (gps->triangles) MEM_freeN(gps->triangles);
+						MEM_SAFE_FREE(gps->triangles);
 						BLI_freelinkN(&gpf->strokes, gps);
 
 						changed = true;
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 7d6735d2841..9deeeccfce4 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -721,7 +721,7 @@ void ED_gpencil_strokes_copybuf_free(void)
 			BKE_gpencil_free_stroke_weights(gps);
 			MEM_freeN(gps->points);
 		}
-		if (gps->triangles) MEM_freeN(gps->triangles);
+		MEM_SAFE_FREE(gps->triangles);
 
 		BLI_freelinkN(&gp_strokes_copypastebuf, gps);
 	}
@@ -1408,7 +1408,7 @@ static int gp_delete_selected_strokes(bContext *C)
 							BKE_gpencil_free_stroke_weights(gps);
 							MEM_freeN(gps->points);
 						}
-						if (gps->triangles) MEM_freeN(gps->triangles);
+						MEM_SAFE_FREE(gps->triangles);
 						BLI_freelinkN(&gpf->strokes, gps);
 
 						changed = true;
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 5785a5eb3a4..d92dba84d1a 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2535,7 +2535,7 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op)
 	
 	/* try to initialize context data needed while drawing */
 	if (!gpencil_draw_init(C, op, NULL)) {
-		if (op->customdata) MEM_freeN(op->customdata);
+		MEM_SAFE_FREE(op->customdata);
 		/* printf("\tGP - no valid data\n"); */
 		return OPERATOR_CANCELLED;
 	}



More information about the Bf-blender-cvs mailing list