summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivek Dasmohapatra <vivek@collabora.co.uk>2011-06-02 19:11:06 +0100
committerVivek Dasmohapatra <vivek@collabora.co.uk>2011-06-02 19:11:06 +0100
commitfeed5e78989b49983bb9231e5340ec021fc09dc8 (patch)
treec6ed9b4fe2046abaa1dc34eb695cc092df619098
parent98c15e812a24112a8276fa4a62e208a5f008d135 (diff)
downloadtelepathy-mission-control-feed5e78989b49983bb9231e5340ec021fc09dc8.tar.gz
The 'set' GHashTable in collect_satisfied_requests was leaked
-rw-r--r--src/mcd-dispatch-operation.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index cb1e83a3..14e7560f 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -1978,6 +1978,17 @@ observe_channels_cb (TpClient *proxy, const GError *error,
_mcd_dispatch_operation_dec_observers_pending (self, MCD_CLIENT_PROXY (proxy));
}
+static void
+free_satisfied_requests (GPtrArray *requests)
+{
+ guint i;
+
+ for (i = 0; i < requests->len; i++)
+ g_free (g_ptr_array_index (requests, i));
+
+ g_ptr_array_unref (requests);
+}
+
/*
* @paths_out: (out) (transfer container) (element-type utf8):
* Requests_Satisfied
@@ -2010,7 +2021,7 @@ collect_satisfied_requests (const GList *channels,
satisfied_requests = g_ptr_array_sized_new (g_hash_table_size (set));
request_properties = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL, (GDestroyNotify) g_hash_table_unref);
+ g_free, (GDestroyNotify) g_hash_table_unref);
g_hash_table_iter_init (&it, set);
@@ -2018,16 +2029,18 @@ collect_satisfied_requests (const GList *channels,
{
GHashTable *props;
- g_ptr_array_add (satisfied_requests, path);
+ g_ptr_array_add (satisfied_requests, g_strdup (path));
props = _mcd_request_dup_immutable_properties (value);
g_assert (props != NULL);
- g_hash_table_insert (request_properties, path, props);
+ g_hash_table_insert (request_properties, g_strdup (path), props);
}
+ g_hash_table_unref (set);
+
if (paths_out != NULL)
*paths_out = satisfied_requests;
else
- g_ptr_array_unref (satisfied_requests);
+ free_satisfied_requests (satisfied_requests);
if (props_out != NULL)
*props_out = request_properties;
@@ -2110,9 +2123,7 @@ _mcd_dispatch_operation_run_observers (McdDispatchOperation *self)
observe_channels_cb,
g_object_ref (self), g_object_unref, NULL);
- /* don't free the individual object paths, which are borrowed from the
- * McdChannel objects */
- g_ptr_array_unref (satisfied_requests);
+ free_satisfied_requests (satisfied_requests);
_mcd_tp_channel_details_free (channels_array);