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 <campbell@blender.org>2022-08-11 03:50:51 +0300
committerCampbell Barton <campbell@blender.org>2022-08-11 03:57:14 +0300
commitd9c2922a14585ed3c83f98617f4023a3b212683b (patch)
treeadaa606f655431b77ba2195d18716696821cc79b /source/blender/blenkernel/intern/gpencil_curve.c
parent4641d6d7b0199b9df765141e00af4ce86155de82 (diff)
Cleanup: remove redundant MEM_SAFE_FREE
MEM_SAFE_FREE isn't necessary when the memory is known to be allocated and clearing the value afterwards isn't necessary.
Diffstat (limited to 'source/blender/blenkernel/intern/gpencil_curve.c')
-rw-r--r--source/blender/blenkernel/intern/gpencil_curve.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c
index d68b322e4c5..bf224a9613e 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -337,7 +337,6 @@ static void gpencil_convert_spline(Main *bmain,
/* Add stroke to frame. */
BLI_addtail(&gpf->strokes, gps);
- float *coord_array = NULL;
float init_co[3];
switch (nu->type) {
@@ -376,8 +375,7 @@ static void gpencil_convert_spline(Main *bmain,
BezTriple *bezt = &nu->bezt[inext];
bool last = (bool)(s == segments - 1);
- coord_array = MEM_callocN((size_t)3 * resolu * sizeof(float), __func__);
-
+ float *coord_array = MEM_callocN(sizeof(float[3]) * resolu, __func__);
for (int j = 0; j < 3; j++) {
BKE_curve_forward_diff_bezier(prevbezt->vec[1][j],
prevbezt->vec[2][j],
@@ -397,8 +395,9 @@ static void gpencil_convert_spline(Main *bmain,
gpencil_add_new_points(
gps, coord_array, radius_start, radius_end, init, resolu, init_co, last);
+
/* Free memory. */
- MEM_SAFE_FREE(coord_array);
+ MEM_freeN(coord_array);
/* As the last point of segment is the first point of next segment, back one array
* element to avoid duplicated points on the same location.
@@ -419,7 +418,7 @@ static void gpencil_convert_spline(Main *bmain,
nurb_points = (nu->pntsu - 1) * resolu;
}
/* Get all curve points. */
- coord_array = MEM_callocN(sizeof(float[3]) * nurb_points, __func__);
+ float *coord_array = MEM_callocN(sizeof(float[3]) * nurb_points, __func__);
BKE_nurb_makeCurve(nu, coord_array, NULL, NULL, NULL, resolu, sizeof(float[3]));
/* Allocate memory for storage points. */
@@ -429,7 +428,7 @@ static void gpencil_convert_spline(Main *bmain,
/* Add points. */
gpencil_add_new_points(gps, coord_array, 1.0f, 1.0f, 0, gps->totpoints, init_co, false);
- MEM_SAFE_FREE(coord_array);
+ MEM_freeN(coord_array);
}
break;
}