aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-16 16:00:29 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-16 16:00:29 +0000
commitd4e1347af6a2def900790515c76b5620f462ffb3 (patch)
tree18977a1d207b3132db9fde6731e4097c7510c78b
parenta152ac5a7afa274aed07f0f1e8f028a6fd956cb4 (diff)
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 ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@164675 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_sip.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index de7378fa0..520b696ab 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -12704,8 +12704,11 @@ static enum check_auth_result check_peer_ok(struct sip_pvt *p, char *of,
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) {
ao2_t_ref(peer, 1, "copy pointer into (*authpeer)");
(*authpeer) = peer; /* Add a ref to the object here, to keep it in memory a bit longer if it is realtime */