From: David Vossel Date: Fri, 20 May 2011 16:38:28 +0000 (+0000) Subject: chan_sip: Destroy variables on a sip_pvt before copying vars from the sip_peer. X-Git-Tag: 1.4.42-rc2~3^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a93fce4278f5b431cff372e599b37d83fcca4406;p=thirdparty%2Fasterisk.git chan_sip: Destroy variables on a sip_pvt before copying vars from the sip_peer. (closes issue #19202) Reported by: wdoekes Patches: issue19202_destroy_challenged_invite_chanvars.patch uploaded by wdoekes (license 717) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@320055 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index e38f8c3132..5837e0e673 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -10749,7 +10749,9 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ 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); if (sipmethod == SIP_INVITE) { - /* copy channel vars */ + /* destroy old channel vars and copy new channel vars */ + ast_variables_destroy(p->chanvars); + p->chanvars = NULL; for (v = user->chanvars ; v ; v = v->next) { if ((tmpvar = ast_variable_new(v->name, v->value))) { tmpvar->next = p->chanvars; @@ -10909,7 +10911,9 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ ast_string_field_set(p, authname, peer->name); if (sipmethod == SIP_INVITE) { - /* copy channel vars */ + /* destroy old channel vars and copy new channel vars */ + ast_variables_destroy(p->chanvars); + p->chanvars = NULL; for (v = peer->chanvars ; v ; v = v->next) { if ((tmpvar = ast_variable_new(v->name, v->value))) { tmpvar->next = p->chanvars;