[asterisk-commits] rmudgett: branch 1.8 r315349 - /branches/1.8/channels/chan_mgcp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 25 16:49:06 CDT 2011


Author: rmudgett
Date: Mon Apr 25 16:49:00 2011
New Revision: 315349

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=315349
Log:
When using MGCP realtime gateway definitions, random crashes occur.

Fixed incorrect linked list node removal for realtime gateways.

(closes issue #18291)
Reported by: nahuelgreco
Patches:
      dangling-pointers-when-pruning.patch uploaded by nahuelgreco (license 162)

Modified:
    branches/1.8/channels/chan_mgcp.c

Modified: branches/1.8/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_mgcp.c?view=diff&rev=315349&r1=315348&r2=315349
==============================================================================
--- branches/1.8/channels/chan_mgcp.c (original)
+++ branches/1.8/channels/chan_mgcp.c Mon Apr 25 16:49:00 2011
@@ -3754,7 +3754,7 @@
 {
 	int res;
 	int reloading;
-	struct mgcp_gateway *g, *gprev, *gnext;
+	struct mgcp_gateway *g, *gprev;
 	/*struct mgcp_gateway *g;*/
 	/*struct mgcp_endpoint *e;*/
 	/*time_t thispass = 0, lastpass = 0;*/
@@ -3824,12 +3824,10 @@
 			g = gateways;
 			gprev = NULL;
 			while(g) {
-				gnext = g->next;
 				if(g->realtime) {
 					if(mgcp_prune_realtime_gateway(g)) {
 						if(gprev) {
-							gprev->next = gnext;
-							gprev = g;
+							gprev->next = g->next;
 						} else {
 							gateways = g->next;
 						}
@@ -3843,7 +3841,7 @@
 				} else {
 					gprev = g;
 				}
-				g = gnext;
+				g = g->next;
 			}
 			ast_mutex_unlock(&gatelock);
 			lastrun = time(NULL);




More information about the asterisk-commits mailing list