[telepathy-mission-control/master] McdDispatcher: don't leak requested McdChannels if they abort

Simon McVittie simon.mcvittie at collabora.co.uk
Thu May 28 09:07:46 PDT 2009


---
 src/mcd-dispatcher.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 9af1b64..b7bfed6 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1407,14 +1407,6 @@ on_channel_abort_context (McdChannel *channel, McdDispatcherContext *context)
          * FIXME: this is alarmingly fragile */
         _mcd_dispatch_operation_lose_channel (context->operation, channel,
                                               &(context->channels));
-
-        if (li != NULL)
-        {
-            /* we used to have a ref to it, until the CDO removed it from the
-             * linked list. (Do not dereference li at this point - it has
-             * been freed!) */
-            g_object_unref (channel);
-        }
     }
     else
     {
@@ -1422,6 +1414,14 @@ on_channel_abort_context (McdChannel *channel, McdDispatcherContext *context)
         context->channels = g_list_delete_link (context->channels, li);
     }
 
+    if (li != NULL)
+    {
+        /* we used to have a ref to it, until it was removed from the linked
+         * list, either by us or by the CDO. (Do not dereference li at this
+         * point - it has been freed!) */
+        g_object_unref (channel);
+    }
+
     if (context->channels == NULL)
     {
         DEBUG ("Nothing left in this context");
-- 
1.5.6.5




More information about the telepathy-commits mailing list