[Telepathy-commits] [telepathy-gabble/master] GabbleRoster: fix double free on Disconnect

Alban Crequy alban.crequy at collabora.co.uk
Thu Nov 27 10:46:55 PST 2008


---
 src/roster.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/roster.c b/src/roster.c
index 2f95bb3..114e42b 100644
--- a/src/roster.c
+++ b/src/roster.c
@@ -1694,16 +1694,21 @@ gabble_roster_close_all (GabbleRoster *self)
       self->priv->status_changed_id = 0;
     }
 
+  /* Use a temporary variable because we don't want
+   * roster_channel_closed_cb to remove the channel from the hash table a
+   * second time */
   if (priv->group_channels != NULL)
     {
-      g_hash_table_destroy (priv->group_channels);
+      GHashTable *t = priv->group_channels;
       priv->group_channels = NULL;
+      g_hash_table_destroy (t);
     }
 
   if (priv->list_channels != NULL)
     {
-      g_hash_table_destroy (priv->list_channels);
+      GHashTable *t = priv->list_channels;
       priv->list_channels = NULL;
+      g_hash_table_destroy (t);
     }
 
   if (self->priv->iq_cb != NULL)
-- 
1.5.6.5




More information about the Telepathy-commits mailing list