aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-03-23 10:04:14 -0500
committerTed Gould <ted@gould.cx>2011-03-23 10:04:14 -0500
commit1685931d9c57696662a56a4877605440f29734c4 (patch)
tree3b19d3fda3e593ec14bb6ae7b57aa9436afe1a3a /src
parent181fedbc5742d65db8ff4e07bdacad43acf5a307 (diff)
parent531bbc3ffff45f8ac6295d403161dbca53b7043c (diff)
downloadayatana-indicator-datetime-1685931d9c57696662a56a4877605440f29734c4.tar.gz
ayatana-indicator-datetime-1685931d9c57696662a56a4877605440f29734c4.tar.bz2
ayatana-indicator-datetime-1685931d9c57696662a56a4877605440f29734c4.zip
Properly free'ing memory allocated in JSON structures
Diffstat (limited to 'src')
-rw-r--r--src/timezone-completion.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/timezone-completion.c b/src/timezone-completion.c
index f32c051..4df50e0 100644
--- a/src/timezone-completion.c
+++ b/src/timezone-completion.c
@@ -71,7 +71,7 @@ save_and_use_model (TimezoneCompletion * completion, GtkTreeModel * model)
{
TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE(completion);
- g_hash_table_insert (priv->request_table, g_strdup (priv->request_text), g_object_ref (model));
+ g_hash_table_insert (priv->request_table, g_strdup (priv->request_text), g_object_ref_sink (model));
if (model == priv->initial_model)
gtk_entry_completion_set_match_func (GTK_ENTRY_COMPLETION (completion), NULL, NULL, NULL);
@@ -112,8 +112,10 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data)
JsonReader * reader = json_reader_new (json_parser_get_root (JSON_PARSER (object)));
- if (!json_reader_is_array (reader))
+ if (!json_reader_is_array (reader)) {
+ g_object_unref (G_OBJECT (reader));
return;
+ }
gint i, count = json_reader_count_elements (reader);
for (i = 0; i < count; ++i) {
@@ -163,7 +165,7 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data)
}
save_and_use_model (completion, GTK_TREE_MODEL (store));
- g_object_unref (G_OBJECT (store));
+ g_object_unref (G_OBJECT (reader));
}
static void