Skip to content

Commit d7cc7b9

Browse files
committed
fix a small leak in fill_nearest
1 parent dbe46d1 commit d7cc7b9

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

libvips/morphology/nearest.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ vips_fill_nearest_finalize(GObject *gobject)
8585
{
8686
VipsFillNearest *nearest = (VipsFillNearest *) gobject;
8787

88-
#ifdef DEBUG
89-
printf("vips_fill_nearest_finalize: ");
90-
vips_object_print_name(VIPS_OBJECT(gobject));
91-
printf("\n");
92-
#endif /*DEBUG*/
93-
9488
VIPS_FREEF(g_array_unref, nearest->seeds);
9589

9690
G_OBJECT_CLASS(vips_fill_nearest_parent_class)->finalize(gobject);
@@ -244,8 +238,7 @@ vips_fill_nearest_build(VipsObject *object)
244238
if (i != ps) {
245239
Seed *seed;
246240

247-
g_array_set_size(nearest->seeds,
248-
nearest->seeds->len + 1);
241+
g_array_set_size(nearest->seeds, nearest->seeds->len + 1);
249242
seed = &g_array_index(nearest->seeds,
250243
Seed, nearest->seeds->len - 1);
251244
seed->x = x;
@@ -261,9 +254,9 @@ vips_fill_nearest_build(VipsObject *object)
261254
/* Create the output and distance images in memory.
262255
*/
263256
g_object_set(object, "distance", vips_image_new_memory(), NULL);
264-
if (vips_black(&t[1], nearest->width, nearest->height, NULL) ||
265-
vips_cast(t[1], &t[2], VIPS_FORMAT_FLOAT, NULL) ||
266-
vips_image_write(t[2], nearest->distance))
257+
if (vips_black(&t[0], nearest->width, nearest->height, NULL) ||
258+
vips_cast(t[0], &t[1], VIPS_FORMAT_FLOAT, NULL) ||
259+
vips_image_write(t[1], nearest->distance))
267260
return -1;
268261

269262
g_object_set(object, "out", vips_image_new_memory(), NULL);

0 commit comments

Comments
 (0)