[gegl] Bug 760662 - gegl:noise-solid leaks o->user_data



commit 74bafb92d06681f2bd918aec8601fdf964317f08
Author: Thomas Manni <thomas manni free fr>
Date:   Mon Feb 1 13:51:04 2016 +0100

    Bug 760662 - gegl:noise-solid leaks o->user_data
    
    Free user_data memory allocated during prepare method

 operations/common/noise-solid.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/operations/common/noise-solid.c b/operations/common/noise-solid.c
index df7b1ed..c614a84 100644
--- a/operations/common/noise-solid.c
+++ b/operations/common/noise-solid.c
@@ -257,6 +257,21 @@ prepare (GeglOperation *operation)
   gegl_operation_set_format (operation, "output", format);
 }
 
+static void
+finalize (GObject *object)
+{
+  GeglOperation *op = (void*) object;
+  GeglProperties *o = GEGL_PROPERTIES (op);
+
+  if (o->user_data)
+    {
+      g_slice_free (NsParamsType, o->user_data);
+      o->user_data = NULL;
+    }
+
+  G_OBJECT_CLASS (gegl_op_parent_class)->finalize (object);
+}
+
 static gboolean
 c_process (GeglOperation       *operation,
            void                *out_buf,
@@ -310,12 +325,16 @@ get_bounding_box (GeglOperation *operation)
 static void
 gegl_op_class_init (GeglOpClass *klass)
 {
+  GObjectClass             *object_class;
   GeglOperationClass       *operation_class;
   GeglOperationSourceClass *source_class;
 
+  object_class    = G_OBJECT_CLASS (klass);
   operation_class = GEGL_OPERATION_CLASS (klass);
   source_class = GEGL_OPERATION_SOURCE_CLASS (klass);
 
+  object_class->finalize = finalize;
+
   source_class->process = process;
   operation_class->get_bounding_box = get_bounding_box;
   operation_class->prepare = prepare;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]