don't leak three GimpCoords per warped point (eek).

2007-05-22  Michael Natterer  <mitch@gimp.org>

	* app/vectors/gimpvectors-warp.c (gimp_stroke_warp_point): don't
	leak three GimpCoords per warped point (eek).


svn path=/trunk/; revision=22555
This commit is contained in:
Michael Natterer 2007-05-21 22:46:16 +00:00 committed by Michael Natterer
parent 9928979d4f
commit bea6c5225d
2 changed files with 22 additions and 18 deletions

View File

@ -1,3 +1,8 @@
2007-05-22 Michael Natterer <mitch@gimp.org>
* app/vectors/gimpvectors-warp.c (gimp_stroke_warp_point): don't
leak three GimpCoords per warped point (eek).
2007-05-21 Sven Neumann <sven@gimp.org>
* themes/Default/images/preferences/Makefile.am: formatting.

View File

@ -92,34 +92,33 @@ gimp_stroke_warp_point (const GimpStroke *stroke,
GimpCoords *point_warped,
gdouble y_offset)
{
GimpCoords *point_zero;
GimpCoords *point_minus;
GimpCoords *point_plus;
gdouble slope;
gdouble dx, dy, nx, ny, len;
GimpCoords point_zero = { 0, };
GimpCoords point_minus = { 0, };
GimpCoords point_plus = { 0, };
gdouble slope;
gdouble dx, dy, nx, ny, len;
point_zero = (GimpCoords*) g_new0 (GimpCoords, 1);
point_minus = (GimpCoords*) g_new0 (GimpCoords, 1);
point_plus = (GimpCoords*) g_new0 (GimpCoords, 1);
if (! gimp_stroke_get_point_at_dist (stroke, x, EPSILON, point_zero, &slope))
if (! gimp_stroke_get_point_at_dist (stroke, x, EPSILON,
&point_zero, &slope))
{
point_warped->x = 0;
point_warped->y = 0;
return;
}
point_warped->x = point_zero->x;
point_warped->y = point_zero->y;
point_warped->x = point_zero.x;
point_warped->y = point_zero.y;
if (! gimp_stroke_get_point_at_dist (stroke, x - DX, EPSILON, point_minus, &slope))
if (! gimp_stroke_get_point_at_dist (stroke, x - DX, EPSILON,
&point_minus, &slope))
return;
if (! gimp_stroke_get_point_at_dist (stroke, x + DX, EPSILON, point_plus, &slope))
if (! gimp_stroke_get_point_at_dist (stroke, x + DX, EPSILON,
&point_plus, &slope))
return;
dx = point_plus->x - point_minus->x;
dy = point_plus->y - point_minus->y;
dx = point_plus.x - point_minus.x;
dy = point_plus.y - point_minus.y;
len = hypot (dx, dy);
@ -129,8 +128,8 @@ gimp_stroke_warp_point (const GimpStroke *stroke,
nx = - dy / len;
ny = dx / len;
point_warped->x = point_zero->x + nx * (y - y_offset);
point_warped->y = point_zero->y + ny * (y - y_offset);
point_warped->x = point_zero.x + nx * (y - y_offset);
point_warped->y = point_zero.y + ny * (y - y_offset);
}
static void