[Bf-blender-cvs] [2c45ecba784] temp-gpencil-bezier-stroke-type: GPencil: Fix memory leak when freeing editcurve
Falk David
noreply at git.blender.org
Sat Apr 3 11:01:34 CEST 2021
Commit: 2c45ecba7847eeab358f98eeb7eb03d1bcb84fb5
Author: Falk David
Date: Sat Apr 3 11:00:40 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rB2c45ecba7847eeab358f98eeb7eb03d1bcb84fb5
GPencil: Fix memory leak when freeing editcurve
===================================================================
M source/blender/blenkernel/intern/gpencil.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 18ed49561b2..30b1cdfab30 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -379,16 +379,6 @@ void BKE_gpencil_free_stroke_weights(bGPDstroke *gps)
return;
}
- if (GPENCIL_STROKE_TYPE_BEZIER(gps)) {
- bGPDcurve *gpc = gps->editcurve;
- if (gpc->dvert != NULL) {
- for (int i = 0; i < gpc->tot_curve_points; i++) {
- MDeformVert *dvert = &gpc->dvert[i];
- BKE_gpencil_free_point_weights(dvert);
- }
- }
- }
-
if (gps->dvert == NULL) {
return;
}
@@ -404,12 +394,19 @@ void BKE_gpencil_free_stroke_editcurve(bGPDstroke *gps)
if (gps == NULL) {
return;
}
- bGPDcurve *editcurve = gps->editcurve;
- if (editcurve == NULL) {
+ bGPDcurve *gpc = gps->editcurve;
+ if (gpc == NULL) {
return;
}
- MEM_freeN(editcurve->curve_points);
- MEM_freeN(editcurve);
+ MEM_freeN(gpc->curve_points);
+ if (gpc->dvert != NULL) {
+ for (int i = 0; i < gpc->tot_curve_points; i++) {
+ MDeformVert *dvert = &gpc->dvert[i];
+ BKE_gpencil_free_point_weights(dvert);
+ }
+ MEM_freeN(gpc->dvert);
+ }
+ MEM_freeN(gpc);
gps->editcurve = NULL;
}
More information about the Bf-blender-cvs
mailing list