[Bf-blender-cvs] [577239d2ced] master: GPencil: Fix unreported memory leak for weights

Antonio Vazquez noreply at git.blender.org
Fri Sep 13 11:18:53 CEST 2019


Commit: 577239d2ced993ffe795ee209b303ef1af55d962
Author: Antonio Vazquez
Date:   Fri Sep 13 11:18:40 2019 +0200
Branches: master
https://developer.blender.org/rB577239d2ced993ffe795ee209b303ef1af55d962

GPencil: Fix unreported memory leak for weights

As the total of points was changed before free memory, if the total was lower than before, the remaining points were not released.

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

M	source/blender/blenkernel/intern/gpencil.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 9ac61c69d04..b93cfefa97d 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1730,7 +1730,6 @@ bool BKE_gpencil_sample_stroke(bGPDstroke *gps, const float dist, const bool sel
   }
 
   gps->points = new_pt;
-  gps->totpoints = i;
   MEM_freeN(pt); /* original */
 
   if (new_dv) {
@@ -1741,6 +1740,8 @@ bool BKE_gpencil_sample_stroke(bGPDstroke *gps, const float dist, const bool sel
     gps->dvert = new_dv;
   }
 
+  gps->totpoints = i;
+
   gps->flag |= GP_STROKE_RECALC_GEOMETRY;
   gps->tot_triangles = 0;



More information about the Bf-blender-cvs mailing list