[Bf-blender-cvs] [35c9af757c7] soc-2021-curves: Fixed memory leak in curve pen - move segment

dilithjay noreply at git.blender.org
Thu Jul 29 11:27:14 CEST 2021


Commit: 35c9af757c7a51c3f162759f3ee9cf8c19e34ae2
Author: dilithjay
Date:   Thu Jul 29 09:06:13 2021 +0530
Branches: soc-2021-curves
https://developer.blender.org/rB35c9af757c7a51c3f162759f3ee9cf8c19e34ae2

Fixed memory leak in curve pen - move segment

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

M	source/blender/editors/curve/editcurve_pen.c

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

diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c
index bdd3b566add..89ff3ca5eeb 100644
--- a/source/blender/editors/curve/editcurve_pen.c
+++ b/source/blender/editors/curve/editcurve_pen.c
@@ -656,14 +656,15 @@ static bool is_curve_nearby(ViewContext *vc, wmOperator *op, const wmEvent *even
 
   update_data_for_all_nurbs(nurbs, vc, &data);
 
-  MoveSegmentData *seg_data;
-  op->customdata = seg_data = MEM_callocN(sizeof(MoveSegmentData), "MoveSegmentData");
-  seg_data->bezt_index = data.bezt_index;
-  seg_data->nu = data.nurb;
-
   float threshold_distance = get_view_zoom(data.cut_loc, vc);
-
-  return data.min_dist < threshold_distance;
+  if (data.min_dist < threshold_distance) {
+    MoveSegmentData *seg_data;
+    op->customdata = seg_data = MEM_callocN(sizeof(MoveSegmentData), "MoveSegmentData");
+    seg_data->bezt_index = data.bezt_index;
+    seg_data->nu = data.nurb;
+    return true;
+  }
+  return false;
 }
 
 /* Move segment to mouse pointer. */



More information about the Bf-blender-cvs mailing list