Don't free the resolved addresses if they have already been freed. Fixed LM-96
authorMikael Hallendal <micke@imendio.com>
Tue, 24 Apr 2007 19:42:00 +0200
changeset 258 b67af7fc111f
parent 252 6aefcc6153f4
child 259 17c0fe07536c
Don't free the resolved addresses if they have already been freed. Fixed LM-96 Patch from Senko Rasic
loudmouth/lm-connection.c
--- a/loudmouth/lm-connection.c	Sun Feb 25 00:13:01 2007 +0100
+++ b/loudmouth/lm-connection.c	Tue Apr 24 19:42:00 2007 +0200
@@ -511,9 +511,13 @@
 			_lm_utils_free_callback (cb);
 		}
 		
-		freeaddrinfo (connect_data->resolved_addrs);
-		connection->connect_data = NULL;
-		g_free (connect_data);
+		/* If the user callback called connection_close(), this is
+		 * already freed */
+		if (connection->connect_data) {
+			freeaddrinfo (connect_data->resolved_addrs);
+			connection->connect_data = NULL;
+			g_free (connect_data);
+		}
 	} else {
 		/* try to connect to the next host */
 		connection_do_connect (connect_data);