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
--- 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;
}