diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 88aada55aa..e59f34cc83 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -12062,6 +12062,12 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf, } if (tmp) { + /* 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; + } + int chan_sig = conf->chan.sig; if (!here) { @@ -17555,6 +17561,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 */