aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authoroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2010-09-19 15:56:50 +0000
committeroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2010-09-19 15:56:50 +0000
commit80adcdf61ea4f17c2f5e60035d5fde2d5f7f90ce (patch)
tree5f1c287fe3fc677af806fd892b2cab48cdfa7399 /main
parent7d52d677b23c6101488428cf7247995409d1df34 (diff)
Make sure we always free variables properly in manager originate.
(closes issue #17891) reported, solved and tested by oej Review: https://reviewboard.asterisk.org/r/869/ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@287469 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/manager.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/main/manager.c b/main/manager.c
index fb4c8139e..a43a78af6 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1961,7 +1961,7 @@ static int action_originate(struct mansession *s, const struct message *m)
const char *async = astman_get_header(m, "Async");
const char *id = astman_get_header(m, "ActionID");
const char *codecs = astman_get_header(m, "Codecs");
- struct ast_variable *vars = astman_get_variables(m);
+ struct ast_variable *vars;
char *tech, *data;
char *l = NULL, *n = NULL;
int pi = 0;
@@ -2011,6 +2011,9 @@ static int action_originate(struct mansession *s, const struct message *m)
format = 0;
ast_parse_allow_disallow(NULL, &format, codecs, 1);
}
+ /* Allocate requested channel variables */
+ vars = astman_get_variables(m);
+
if (ast_true(async)) {
struct fast_originate_helper *fast = ast_calloc(1, sizeof(*fast));
if (!fast) {
@@ -2050,6 +2053,9 @@ static int action_originate(struct mansession *s, const struct message *m)
res = ast_pbx_outgoing_exten(tech, format, data, to, context, exten, pi, &reason, 1, l, n, vars, account, NULL);
else {
astman_send_error(s, m, "Originate with 'Exten' requires 'Context' and 'Priority'");
+ if (vars) {
+ ast_variables_destroy(vars);
+ }
return 0;
}
}