From: Luigi Rizzo Date: Tue, 19 Dec 2006 09:33:57 +0000 (+0000) Subject: stop what i think is a memory leak in case Dial fails to X-Git-Tag: 1.6.0-beta1~3^2~3691 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c81431c9379777f422761daccd2c5ae884724ea;p=thirdparty%2Fasterisk.git stop what i think is a memory leak in case Dial fails to connect to a channel. Before committing to 1.4 i would like some other people to review and test this fix - thanks. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48574 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_dial.c b/apps/app_dial.c index eba3ff53f4..9ffd585897 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1295,6 +1295,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags handle_cause(cause, &num); if (!rest) /* we are on the last destination */ chan->hangupcause = cause; + free(tmp); continue; } pbx_builtin_setvar_helper(tmp->chan, "DIALEDPEERNUMBER", numsubst); @@ -1338,6 +1339,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags } if (!tmp->chan) { handle_cause(cause, &num); + free(tmp); continue; } } @@ -1398,6 +1400,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags ast_verbose(VERBOSE_PREFIX_3 "Couldn't call %s\n", numsubst); ast_hangup(tmp->chan); tmp->chan = NULL; + free(tmp); continue; } else { senddialevent(chan, tmp->chan);