[asterisk-bugs] [Asterisk 0017450]: [patch] "setvar" can add multiple variables with the same name to a channel
Asterisk Bug Tracker
noreply at bugs.digium.com
Tue Apr 12 15:48:17 CDT 2011
A NOTE has been added to this issue.
======================================================================
https://issues.asterisk.org/view.php?id=17450
======================================================================
Reported By: nahuelgreco
Assigned To: jrose
======================================================================
Project: Asterisk
Issue ID: 17450
Category: Channels/chan_dahdi
Reproducibility: always
Severity: minor
Priority: normal
Status: closed
Asterisk Version: SVN
JIRA: SWP-1635
Regression: No
Reviewboard Link:
SVN Branch (only for SVN checkouts, not tarball releases): trunk
SVN Revision (number only!): 267095
Request Review:
Resolution: fixed
Fixed in Version:
======================================================================
Date Submitted: 2010-06-02 17:28 CDT
Last Modified: 2011-04-12 15:48 CDT
======================================================================
Summary: [patch] "setvar" can add multiple variables with the
same name to a channel
Description:
Suppose the following piece of chan_dahdi.conf:
setvar=V1=foo
channel => 1
setvar=V2=bar
channel => 2
setvar=V1=baz
channel => 3
In the current trunk version, each channel (dahdi_pvt structure) will have
his own copies of the variables (after
https://issues.asterisk.org/view.php?id=16359 fix). For example, the
ast_variables linked list for channel 3 will have the following form:
channel 3: V1=foo -> V2=bar -> V1=baz
When a call is made and dahdi_new(...) is executed, dahdi_new(...) will
processes the variables list left-to-right, so for a call in channel 3 the
value of V1 for that call will be finally "baz" because is the last one to
be set by dahdi_new(...). This makes the bug benevolous, the call variables
will be ok, but if you do a "dahdi show channel 3" you will see the two
versions of V1, and that's wrong. Before the
https://issues.asterisk.org/view.php?id=16359 fix the bug was worse,
because the call in channel 3 got V1=foo.
A patch against trunk removing the duplicates is attached.
Also, there is a conceptual mismatch. The documentation in
chan_dahdi.conf.sample states that "setvar" defines a "Channel variable to
be set for all calls from this channel". Maybe the correct behaviour is to
get only V1 defined for channel 3 and not V2, by resetting the setvar list
(confp->chan.vars) after each "channel" statement.
I also think the linked list built at confp->chan.vars is probably leaking
across reloads.
======================================================================
----------------------------------------------------------------------
(0133685) svnbot (reporter) - 2011-04-12 15:48
https://issues.asterisk.org/view.php?id=17450#c133685
----------------------------------------------------------------------
Repository: asterisk
Revision: 313437
_U trunk/
U trunk/channels/chan_dahdi.c
------------------------------------------------------------------------
r313437 | jrose | 2011-04-12 13:50:11 -0500 (Tue, 12 Apr 2011) | 39 lines
Merged revisions 313435 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
also went ahead and fixed the problem it introduces before committing.
........
r313435 | jrose | 2011-04-12 13:44:44 -0500 (Tue, 12 Apr 2011) | 1 line
fixing stupid mistake with putting code before variable declaration
........
Merged revisions 313433 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
........
r313432 | jrose | 2011-04-12 13:12:29 -0500 (Tue, 12 Apr 2011) | 14
lines
reload Chan_dahdi memory leak caused by variables
chan_dahdi reloading with variables set via setvar in
chan_dahdi.conf would
stay in the dahdi_pvt structs for individual channels (causing them
to just
continue adding the new ones to the list) and also there was a
memory leak
causes by the conf objects. This patch resolves both of these by
using
ast_variables_destroy during the loading process.
(closes issue https://issues.asterisk.org/view.php?id=17450)
Reported by: nahuelgreco
Patches:
patch.diff uploaded by jrose (license 1225)
Tested by: tilghman, jrose
Review: https://reviewboard.asterisk.org/r/1170/
........
........
........
------------------------------------------------------------------------
http://svn.digium.com/view/asterisk?view=rev&revision=313437
Issue History
Date Modified Username Field Change
======================================================================
2011-04-12 15:48 svnbot Checkin
2011-04-12 15:48 svnbot Note Added: 0133685
======================================================================
More information about the asterisk-bugs
mailing list