Added checks when freeing proxy and closing socket. Also free open_cb in cancel_open.
authorMikael Hallendal <micke@imendio.com>
Fri, 23 Feb 2007 13:37:26 +0100
changeset 211 efbf2da5e443
parent 210 96b01140c00c
child 212 87bc6b37a9e9
Added checks when freeing proxy and closing socket. Also free open_cb in cancel_open. Patch from Senko Rasic and modified slightly by Mikael Hallendal
loudmouth/lm-connection.c
--- a/loudmouth/lm-connection.c	Fri Feb 23 13:29:18 2007 +0100
+++ b/loudmouth/lm-connection.c	Fri Feb 23 13:37:26 2007 +0100
@@ -180,6 +180,10 @@
 
 	lm_connection_set_disconnect_function (connection, NULL, NULL, NULL);
 
+	if (connection->proxy) {
+		lm_proxy_unref (connection->proxy);
+	}
+
 	lm_message_queue_unref (connection->queue);
 
         if (connection->context) {
@@ -417,7 +421,9 @@
 {
 	connection_stop_keep_alive (connection);
 
-	lm_socket_close (connection->socket);
+	if (connection->socket) {
+		lm_socket_close (connection->socket);
+	}
 
 	lm_message_queue_detach (connection->queue);
 	
@@ -934,6 +940,11 @@
 {
 	g_return_if_fail (connection != NULL);
 
+	if (connection->open_cb) {
+		_lm_utils_free_callback (connection->open_cb);
+		connection->open_cb = NULL;
+	}
+
 	connection->cancel_open = TRUE;
 }