From 577239d2ced993ffe795ee209b303ef1af55d962 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Fri, 13 Sep 2019 11:18:40 +0200 Subject: [PATCH] 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. --- source/blender/blenkernel/intern/gpencil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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;