Commit fb80e6f8 authored by Massimo Valentini's avatar Massimo Valentini

memory leaks

parent d8cdb9a6
......@@ -251,6 +251,7 @@ main (gint argc,
break;
}
g_list_free_full (o->files, g_free);
g_free (o);
g_object_unref (gegl);
g_free (script);
......
......@@ -213,19 +213,19 @@ gegl_buffer_linear_close (GeglBuffer *buffer,
if (tile)
{
gegl_tile_unlock (tile);
gegl_tile_unref (tile);
g_object_set_data (G_OBJECT (buffer), "linear-tile", NULL);
tile = NULL;
}
else
{
GList *linear_buffers;
GList *iter;
BufferInfo *info = NULL;
linear_buffers = g_object_get_data (G_OBJECT (buffer), "linear-buffers");
for (iter = linear_buffers; iter; iter=iter->next)
{
info = iter->data;
BufferInfo *info = iter->data;
if (info->buf == linear)
{
info->refs--;
......@@ -238,26 +238,20 @@ gegl_buffer_linear_close (GeglBuffer *buffer,
*/
}
linear_buffers = g_list_remove (linear_buffers, info);
g_object_set_data (G_OBJECT (buffer), "linear-buffers", linear_buffers);
g_mutex_unlock (buffer->tile_storage->mutex);
/* XXX: potential race */
gegl_buffer_set (buffer, &info->extent, info->format, info->buf, 0);
gegl_free (info->buf);
g_free (info);
g_mutex_lock (buffer->tile_storage->mutex);
break;
}
else
{
info = NULL;
}
}
if (info)
{
linear_buffers = g_list_remove (linear_buffers, linear);
gegl_free (info->buf);
g_free (info);
}
g_object_set_data (G_OBJECT (buffer), "linear-buffers", linear_buffers);
}
/*gegl_buffer_unlock (buffer);*/
g_mutex_unlock (buffer->tile_storage->mutex);
......
......@@ -356,6 +356,8 @@ gint gegl_buffer_leaks (void)
g_printerr ("%s\n", buffer->alloc_stack_trace);
}
}
g_list_free (allocated_buffers_list);
allocated_buffers_list = NULL;
#endif
return allocated_buffers - de_allocated_buffers;
......@@ -395,9 +397,11 @@ static void
gegl_buffer_finalize (GObject *object)
{
#ifdef GEGL_BUFFER_DEBUG_ALLOCATIONS
g_free (GEGL_BUFFER (object)->alloc_stack_trace);
allocated_buffers_list = g_list_remove (allocated_buffers_list, object);
#endif
g_free (GEGL_BUFFER (object)->path);
de_allocated_buffers++;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......
......@@ -36,6 +36,7 @@ enum
PROP_LAST
};
static void gegl_sampler_cubic_finalize (GObject *gobject);
static void gegl_sampler_cubic_get (GeglSampler *sampler,
gdouble x,
gdouble y,
......@@ -64,6 +65,7 @@ gegl_sampler_cubic_class_init (GeglSamplerCubicClass *klass)
object_class->set_property = set_property;
object_class->get_property = get_property;
object_class->finalize = gegl_sampler_cubic_finalize;
sampler_class->get = gegl_sampler_cubic_get;
......@@ -94,6 +96,13 @@ gegl_sampler_cubic_class_init (GeglSamplerCubicClass *klass)
}
static void
gegl_sampler_cubic_finalize (GObject *object)
{
g_free (GEGL_SAMPLER_CUBIC (object)->type);
G_OBJECT_CLASS (gegl_sampler_cubic_parent_class)->finalize (object);
}
static void
gegl_sampler_cubic_init (GeglSamplerCubic *self)
{
......
......@@ -509,7 +509,7 @@ static void each_ref (gpointer value,
gegl_node_get (dest_node, "ref", &ref, NULL);
source_node = g_hash_table_lookup (pd->ids, ref);
g_free (ref);
gegl_node_connect_from (dest_node, "input", source_node, "output");
}
......
......@@ -234,7 +234,7 @@ gegl_node_dispose (GObject *gobject)
{
gint i;
for (i=0; i<4; i++)
for (i=0; i<GEGL_MAX_THREADS; i++)
if (self->priv->eval_mgr[i])
{
g_object_unref (self->priv->eval_mgr[i]);
......
......@@ -88,9 +88,11 @@ gegl_eval_mgr_finalize (GObject *self_object)
#endif
g_object_unref (self->prepare_visitor);
g_object_unref (self->have_visitor);
g_object_unref (self->eval_visitor);
g_object_unref (self->need_visitor);
g_object_unref (self->finish_visitor);
g_free (self->pad_name);
G_OBJECT_CLASS (gegl_eval_mgr_parent_class)->finalize (self_object);
}
......
......@@ -46,7 +46,7 @@ enum
PROP_LANCZOS_WIDTH
};
static void gegl_affine_finalize (GObject *object);
static void gegl_affine_get_property (GObject *object,
guint prop_id,
GValue *value,
......@@ -180,6 +180,7 @@ op_affine_class_init (OpAffineClass *klass)
gobject_class->set_property = gegl_affine_set_property;
gobject_class->get_property = gegl_affine_get_property;
gobject_class->finalize = gegl_affine_finalize;
op_class->get_invalidated_by_change = gegl_affine_get_invalidated_by_change;
op_class->get_bounding_box = gegl_affine_get_bounding_box;
......@@ -233,6 +234,12 @@ op_affine_class_init (OpAffineClass *klass)
G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
}
static void
gegl_affine_finalize (GObject *object)
{
g_free (OP_AFFINE (object)->filter);
G_OBJECT_CLASS (op_affine_parent_class)->finalize (object);
}
static void
op_affine_init (OpAffine *self)
......@@ -288,7 +295,7 @@ gegl_affine_set_property (GObject *object,
break;
case PROP_FILTER:
g_free (self->filter);
self->filter = g_strdup (g_value_get_string (value));
self->filter = g_value_dup_string (value);
break;
case PROP_HARD_EDGES:
self->hard_edges = g_value_get_boolean (value);
......@@ -897,6 +904,7 @@ gegl_affine_process (GeglOperation *operation,
src_rect.height -= context_rect.height;
gegl_affine_fast_reflect_x (output, input, result, &src_rect);
g_object_unref (sampler);
if (input != NULL)
g_object_unref (input);
......@@ -927,6 +935,7 @@ gegl_affine_process (GeglOperation *operation,
src_rect.height -= context_rect.height;
gegl_affine_fast_reflect_y (output, input, result, &src_rect);
g_object_unref (sampler);
if (input != NULL)
g_object_unref (input);
......
......@@ -42,6 +42,7 @@ static void attach (GeglOperation *operation)
{
GeglNode *gegl = operation->node;
GeglNode *input, *output, *over, *translate, *opacity, *blur, *darken, *black;
GeglColor *black_color = gegl_color_new ("rgb(0.0,0.0,0.0)");
input = gegl_node_get_input_proxy (gegl, "input");
output = gegl_node_get_output_proxy (gegl, "output");
......@@ -51,8 +52,9 @@ static void attach (GeglOperation *operation)
blur = gegl_node_new_child (gegl, "operation", "gegl:gaussian-blur", NULL);
darken = gegl_node_new_child (gegl, "operation", "gegl:src-in", NULL);
black = gegl_node_new_child (gegl, "operation", "gegl:color",
"value", gegl_color_new ("rgb(0.0,0.0,0.0)"),
"value", black_color,
NULL);
g_object_unref (black_color);
gegl_node_link_many (input, darken, blur, opacity, translate, over, output, NULL);
gegl_node_connect_from (over, "aux", input, "output");
......
......@@ -1059,6 +1059,7 @@ fattal02_find_percentiles (const gfloat *array,
*min_value = sorting[(guint)(min_percent * size)];
*max_value = sorting[(guint)(max_percent * size)];
g_free (sorting);
}
/********************************************************************/
......@@ -1292,6 +1293,9 @@ fattal02_process (GeglOperation *operation,
gegl_buffer_set (output, result, babl_format (OUTPUT_FORMAT), pix,
GEGL_AUTO_ROWSTRIDE);
g_free (pix);
g_free (lum_out);
g_free (lum_in);
return TRUE;
}
......
......@@ -1330,6 +1330,7 @@ matting_solve_level (gdouble *restrict pixels,
trimap[i * COMPONENTS_AUX + AUX_VALUE] *= roundf (trimap[i * COMPONENTS_AUX + AUX_VALUE]) *
trimap[i * COMPONENTS_AUX + AUX_ALPHA];
}
g_free (eroded_alpha);
}
/* Ordinary solution of the matting laplacian */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment