[Asterisk-Dev] Patch for Bug and memory leak in chan_iax[2].c dialplan caching

Karl Putland karl at putland.linux-site.net
Sun May 18 08:33:39 MST 2003


prev was never set while iterating over the cache.
So essentially If there were entries early in the list that had not
expired and an expired entry was found, the entire valid part of the
cache gets lost and never freed.

--Karl

Index: channels/chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.22
diff -u -r1.22 chan_iax2.c
--- channels/chan_iax2.c        14 May 2003 05:33:06 -0000      1.22
+++ channels/chan_iax2.c        18 May 2003 15:46:16 -0000
@@ -5224,6 +5224,7 @@
                /* We found an entry that matches us! */
                if (!strcmp(dp->peercontext, data) && !strcmp(dp->exten,
exten)) 
                        break;
+        prev = dp;
                dp = next;
        }
        if (!dp) {
Index: channels/chan_iax.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax.c,v
retrieving revision 1.8
diff -u -r1.8 chan_iax.c
--- channels/chan_iax.c 27 Apr 2003 21:36:19 -0000      1.8
+++ channels/chan_iax.c 18 May 2003 15:46:21 -0000
@@ -4841,6 +4841,7 @@
                /* We found an entry that matches us! */
                if (!strcmp(dp->peercontext, data) && !strcmp(dp->exten,
exten)) 
                        break;
+        prev = dp;
                dp = next;
        }
        if (!dp) {

-- 
Karl Putland <karl at putland.linux-site.net>




More information about the asterisk-dev mailing list