Merged revisions 315349 via svnmerge from
[asterisk/asterisk.git] / channels / chan_mgcp.c
index 32886a6..e98b24f 100644 (file)
@@ -3770,7 +3770,7 @@ static void *do_monitor(void *data)
 {
        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;*/
@@ -3840,12 +3840,10 @@ static void *do_monitor(void *data)
                        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;
                                                }
@@ -3859,7 +3857,7 @@ static void *do_monitor(void *data)
                                } else {
                                        gprev = g;
                                }
-                               g = gnext;
+                               g = g->next;
                        }
                        ast_mutex_unlock(&gatelock);
                        lastrun = time(NULL);