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.
This commit is contained in:
Antonio Vazquez 2019-09-13 11:18:40 +02:00
parent bb7c858598
commit 577239d2ce
1 changed files with 2 additions and 1 deletions

View File

@ -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;