[Asterisk-cvs] libpri q931.c,1.61,1.62

markster at lists.digium.com markster at lists.digium.com
Sun Jun 6 18:24:19 CDT 2004


Update of /usr/cvsroot/libpri
In directory mongoose.digium.com:/tmp/cvs-serv30819

Modified Files:
	q931.c 
Log Message:
Be careful not to destroy non-existant calls


Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri/q931.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- q931.c	6 Jun 2004 01:21:41 -0000	1.61
+++ q931.c	6 Jun 2004 23:26:43 -0000	1.62
@@ -1353,13 +1353,13 @@
 	return q931_getcall(pri, pri->cref | 0x8000);
 }
 
-static void q931_destroycall(struct pri *pri, int cr)
+static void q931_destroy(struct pri *pri, int cr, q931_call *c)
 {
 	q931_call *cur, *prev;
 	prev = NULL;
 	cur = pri->calls;
 	while(cur) {
-		if (cur->cr == cr) {
+		if ((c && (cur == c)) || (!c && (cur->cr == cr))) {
 			if (prev)
 				prev->next = cur->next;
 			else
@@ -1377,11 +1377,19 @@
 	pri_error("Can't destroy call %d!\n", cr);
 }
 
-void __q931_destroycall(struct pri *pri, q931_call *c) {
+static void q931_destroycall(struct pri *pri, int cr)
+{
+	return q931_destroy(pri, cr, NULL);
+}
+
+
+void __q931_destroycall(struct pri *pri, q931_call *c) 
+{
 	if (pri && c)
-		q931_destroycall(pri,c->cr);
+		q931_destroy(pri,0, c);
 	return;
 }
+
 static int add_ie(struct pri *pri, q931_call *call, int msgtype, int ie, q931_ie *iet, int maxlen)
 {
 	unsigned int x;




More information about the svn-commits mailing list