[Telepathy-commits] [telepathy-mission-control/master] McdDispatcher: get_channel_filter_cb: cope with errors

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Mar 26 09:20:40 PDT 2009


It is wrong to dereference out_Value if the Get() call failed (in practice
we'll get filters == NULL and an invalid access to (void *) 0x4); it
seems reasonable to treat an error as equivalent to an empty list.

(Reproduced by using Valgrind on a slightly modified test-connect.py.)
---
 src/mcd-dispatcher.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index ece3dfa..6c05056 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1963,9 +1963,19 @@ get_channel_filter_cb (TpProxy *proxy,
                        GObject *weak_object)
 {
     GList **client_filters = user_data;
-    GPtrArray *filters = g_value_get_boxed (out_Value);
+    GPtrArray *filters;
     guint i;
 
+    if (error != NULL)
+    {
+        DEBUG ("error getting a filter list for client %s: %s #%d: %s",
+               tp_proxy_get_object_path (proxy),
+               g_quark_to_string (error->domain), error->code, error->message);
+        return;
+    }
+
+    filters = g_value_get_boxed (out_Value);
+
     for (i = 0 ; i < filters->len ; i++)
     {
         GHashTable *channel_class = g_ptr_array_index (filters, i);
-- 
1.5.6.5




More information about the telepathy-commits mailing list