diff freeDiameter/p_cnx.c @ 50:dbba83bafd66

Fix small bug
author thedoc@morbier.koganei.wide.ad.jp
date Fri, 27 Nov 2009 16:57:26 +0900
parents 204718b0fa54
children bb45a8ffec77
line wrap: on
line diff
--- a/freeDiameter/p_cnx.c	Fri Nov 27 16:45:32 2009 +0900
+++ b/freeDiameter/p_cnx.c	Fri Nov 27 16:57:26 2009 +0900
@@ -51,10 +51,12 @@
 
 static __inline__ void failed_connection_attempt(struct fd_peer * peer)
 {
-	/* Simply remove the first item in the list */
-	struct fd_list * li = peer->p_connparams.next;
-	fd_list_unlink(li);
-	free(li);
+	/* Simply remove the first item in the list if not empty */
+	if (! FD_IS_LIST_EMPTY(&peer->p_connparams) ) {
+		struct fd_list * li = peer->p_connparams.next;
+		fd_list_unlink(li);
+		free(li);
+	}
 }
 
 static void empty_connection_list(struct fd_peer * peer)
"Welcome to our mercurial repository"