aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_dahdi.c
diff options
context:
space:
mode:
authorjrose <jrose@f38db490-d61c-443f-a65b-d21fe96a405b>2011-04-12 18:50:11 +0000
committerjrose <jrose@f38db490-d61c-443f-a65b-d21fe96a405b>2011-04-12 18:50:11 +0000
commit54949dbae555f089faa18977e11b618563133a53 (patch)
tree1f346b97e99f4112e17f38ce5133065cda131421 /channels/chan_dahdi.c
parent31f3a52fa7e9c49d9ec2d7c5e48745c90b2a4587 (diff)
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 #17450) Reported by: nahuelgreco Patches: patch.diff uploaded by jrose (license 1225) Tested by: tilghman, jrose Review: https://reviewboard.asterisk.org/r/1170/ ........ ........ ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@313437 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_dahdi.c')
-rw-r--r--channels/chan_dahdi.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index f4a81131b..79257b0ac 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -12138,6 +12138,12 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
if (tmp) {
int chan_sig = conf->chan.sig;
+ /* If there are variables in tmp before it is updated to match the new config, clear them */
+ if (reloading && tmp->vars) {
+ ast_variables_destroy(tmp->vars);
+ tmp->vars = NULL;
+ }
+
if (!here) {
/* Can only get here if this is a new channel interface being created. */
if ((channel != CHAN_PSEUDO)) {
@@ -17817,6 +17823,13 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
} else if (!(options & PROC_DAHDI_OPT_NOWARN) )
ast_log(LOG_WARNING, "Ignoring any changes to '%s' (on reload) at line %d.\n", v->name, v->lineno);
}
+
+ /* Since confp has already filled invidual dahdi_pvt objects with channels at this point, clear the variables in confp's pvt. */
+ if (confp->chan.vars) {
+ ast_variables_destroy(confp->chan.vars);
+ confp->chan.vars = NULL;
+ }
+
if (dahdichan[0]) {
/* The user has set 'dahdichan' */
/*< \todo pass proper line number instead of 0 */