[libss7-commits] mattf: trunk r37 - /trunk/ss7.c

libss7-commits at lists.digium.com libss7-commits at lists.digium.com
Wed Sep 6 10:14:40 MST 2006


Author: mattf
Date: Wed Sep  6 12:14:40 2006
New Revision: 37

URL: http://svn.digium.com/view/libss7?rev=37&view=rev
Log:
Fix segfault due to but in alarm handling code

Modified:
    trunk/ss7.c

Modified: trunk/ss7.c
URL: http://svn.digium.com/view/libss7/trunk/ss7.c?rev=37&r1=36&r2=37&view=diff
==============================================================================
--- trunk/ss7.c (original)
+++ trunk/ss7.c Wed Sep  6 12:14:40 2006
@@ -146,11 +146,13 @@
 	int winner = -1;
 
 	for (i = 0; i < ss7->numlinks; i++) {
-		if (ss7->links[i]->fd == fd)
-			winner = i;
+		if (ss7->links[i]->fd == fd) {
+			winner = i;
+			break;
+		}
 	}
 	if (winner > -1)
-		mtp2_stop(ss7->links[i]);
+		mtp2_stop(ss7->links[winner]);
 }
 
 void ss7_link_noalarm(struct ss7 *ss7, int fd)
@@ -159,11 +161,13 @@
 	int winner = -1;
 
 	for (i = 0; i < ss7->numlinks; i++) {
-		if (ss7->links[i]->fd == fd)
-			winner = i;
+		if (ss7->links[i]->fd == fd) {
+			winner = i;
+			break;
+		}
 	}
 	if (winner > -1)
-		mtp2_start(ss7->links[i]);
+		mtp2_start(ss7->links[winner]);
 }
 
 int ss7_add_link(struct ss7 *ss7, int fd)



More information about the libss7-commits mailing list