[Bf-blender-cvs] [f91a232] soc-2013-paint: Deleting all curve points led to invalid memory access.

Antony Riakiotakis noreply at git.blender.org
Sat May 10 18:33:09 CEST 2014


Commit: f91a232f65a2b5927194480f2678551555c146b7
Author: Antony Riakiotakis
Date:   Sat May 10 19:32:59 2014 +0300
https://developer.blender.org/rBf91a232f65a2b5927194480f2678551555c146b7

Deleting all curve points led to invalid memory access.

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

M	source/blender/editors/sculpt_paint/paint_curve.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c
index 5e2b2ee..2ce52eb 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -313,7 +313,10 @@ static int paintcurve_delete_point_exec(bContext *C, wmOperator *op)
 	if (tot_del > 0) {
 		int j = 0;
 		int new_tot = pc->tot_points - tot_del;
-		PaintCurvePoint *points_new = MEM_mallocN(new_tot * sizeof(PaintCurvePoint), "PaintCurvePoint");
+		PaintCurvePoint *points_new = NULL;
+		if (new_tot > 0)
+			points_new = MEM_mallocN(new_tot * sizeof(PaintCurvePoint), "PaintCurvePoint");
+
 		for (i = 0, pcp = pc->points; i < pc->tot_points; i++, pcp++) {
 			if (!(pcp->bez.f2 & DELETE_TAG)) {
 				points_new[j] = pc->points[i];




More information about the Bf-blender-cvs mailing list