[asterisk-commits] russell: branch 1.6.0 r164676 - in /branches/1.6.0: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 16 10:02:23 CST 2008


Author: russell
Date: Tue Dec 16 10:02:22 2008
New Revision: 164676

URL: http://svn.digium.com/view/asterisk?view=rev&rev=164676
Log:
Merged revisions 164675 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r164675 | russell | 2008-12-16 10:00:29 -0600 (Tue, 16 Dec 2008) | 19 lines

Merged revisions 164672 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r164672 | russell | 2008-12-16 09:56:37 -0600 (Tue, 16 Dec 2008) | 11 lines

Fix a memory leak related to the use of the "setvar" configuration option.

The problem was that these variables were being appended to the list of vars
on the sip_pvt every time a re-registration or re-subscription came in.
Since it's just a waste of memory to put them there unless the request was an
INVITE, then the fix is to check the request type before copying the vars.

(closes issue #14037)
Reported by: marvinek
Tested by: russell

........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/channels/chan_sip.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_sip.c?view=diff&rev=164676&r1=164675&r2=164676
==============================================================================
--- branches/1.6.0/channels/chan_sip.c (original)
+++ branches/1.6.0/channels/chan_sip.c Tue Dec 16 10:02:22 2008
@@ -11443,8 +11443,10 @@
 
 	ast_copy_flags(&p->flags[0], &user->flags[0], SIP_FLAGS_TO_COPY);
 	ast_copy_flags(&p->flags[1], &user->flags[1], SIP_PAGE2_FLAGS_TO_COPY);
-	/* copy channel vars */
-	p->chanvars = copy_vars(user->chanvars);
+	if (sipmethod == SIP_INVITE) {
+		/* copy channel vars */
+		p->chanvars = copy_vars(user->chanvars);
+	}
 	p->prefs = user->prefs;
 	/* Set Frame packetization */
 	if (p->rtp) {
@@ -11599,8 +11601,11 @@
 		ast_string_field_set(p, peername, peer->name);
 		ast_string_field_set(p, authname, peer->name);
 
-		/* copy channel vars */
-		p->chanvars = copy_vars(peer->chanvars);
+		if (sipmethod == SIP_INVITE) {
+			/* copy channel vars */
+			p->chanvars = copy_vars(peer->chanvars);
+		}
+
 		if (authpeer) {
 			(*authpeer) = ASTOBJ_REF(peer);	/* Add a ref to the object here, to keep it in memory a bit longer if it is realtime */
 		}




More information about the asterisk-commits mailing list