--- a/loudmouth/lm-connection.c Wed Jun 18 22:27:17 2008 +0200
+++ b/loudmouth/lm-connection.c Wed Jun 18 22:27:40 2008 +0200
@@ -187,10 +187,28 @@
gpointer user_data);
static void
+connection_free_handlers (LmConnection *connection)
+{
+ int i;
+
+ /* Unref handlers */
+ for (i = 0; i < LM_MESSAGE_TYPE_UNKNOWN; ++i) {
+ GSList *l;
+
+ for (l = connection->handlers[i]; l; l = l->next) {
+ HandlerData *hd = (HandlerData *) l->data;
+
+ lm_message_handler_unref (hd->handler);
+ g_free (hd);
+ }
+
+ g_slist_free (connection->handlers[i]);
+ }
+}
+
+static void
connection_free (LmConnection *connection)
{
- int i;
-
g_free (connection->server);
g_free (connection->jid);
g_free (connection->effective_jid);
@@ -205,20 +223,8 @@
lm_parser_free (connection->parser);
}
- /* Unref handlers */
- for (i = 0; i < LM_MESSAGE_TYPE_UNKNOWN; ++i) {
- GSList *l;
-
- for (l = connection->handlers[i]; l; l = l->next) {
- HandlerData *hd = (HandlerData *) l->data;
-
- lm_message_handler_unref (hd->handler);
- g_free (hd);
- }
-
- g_slist_free (connection->handlers[i]);
- }
-
+ connection_free_handlers (connection);
+
g_hash_table_destroy (connection->id_handlers);
if (connection->state >= LM_CONNECTION_STATE_OPENING) {
connection_do_close (connection);