[json-glib] reader: Plug a leak
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [json-glib] reader: Plug a leak
- Date: Sun, 6 Feb 2011 23:11:46 +0000 (UTC)
commit a125a724894a08a8d8053fdd2db92d0ad8e2dfd4
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Sun Feb 6 23:10:54 2011 +0000
reader: Plug a leak
Free the current_member string, and since we're destroying data we own
let's do it inside the finalize implementation instead of the dispose
one.
json-glib/json-reader.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/json-glib/json-reader.c b/json-glib/json-reader.c
index a4fa14e..00fe55e 100644
--- a/json-glib/json-reader.c
+++ b/json-glib/json-reader.c
@@ -110,22 +110,19 @@ static GParamSpec *reader_properties[PROP_LAST] = { NULL, };
G_DEFINE_TYPE (JsonReader, json_reader, G_TYPE_OBJECT);
static void
-json_reader_dispose (GObject *gobject)
+json_reader_finalize (GObject *gobject)
{
JsonReaderPrivate *priv = JSON_READER (gobject)->priv;
if (priv->root != NULL)
- {
- json_node_free (priv->root);
- priv->root = NULL;
- priv->current_node = NULL;
- priv->previous_node = NULL;
- }
+ json_node_free (priv->root);
if (priv->error != NULL)
g_clear_error (&priv->error);
- G_OBJECT_CLASS (json_reader_parent_class)->dispose (gobject);
+ g_free (priv->current_member);
+
+ G_OBJECT_CLASS (json_reader_parent_class)->finalize (gobject);
}
static void
@@ -187,7 +184,7 @@ json_reader_class_init (JsonReaderClass *klass)
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS);
- gobject_class->dispose = json_reader_dispose;
+ gobject_class->finalize = json_reader_finalize;
gobject_class->set_property = json_reader_set_property;
gobject_class->get_property = json_reader_get_property;
g_object_class_install_properties (gobject_class, PROP_LAST, reader_properties);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]