From: Jonathan Rose Date: Tue, 12 Apr 2011 18:47:05 +0000 (+0000) Subject: fixing stupid mistake with putting code before variable declaration X-Git-Tag: 1.8.5-rc1~11^2~227 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2600de8c9fe3fac713c0636e68f2b6b20c4d2318;p=thirdparty%2Fasterisk.git fixing stupid mistake with putting code before variable declaration ........ Merged revisions 313435 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: https://origsvn.digium.com/svn/asterisk/branches/1.8@313436 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index e59f34cc83..f9de309192 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -12062,13 +12062,14 @@ 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; } - int chan_sig = conf->chan.sig; if (!here) { /* Can only get here if this is a new channel interface being created. */