]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 287469 via svnmerge from
authorOlle Johansson <oej@edvina.net>
Sun, 19 Sep 2010 16:06:10 +0000 (16:06 +0000)
committerOlle Johansson <oej@edvina.net>
Sun, 19 Sep 2010 16:06:10 +0000 (16:06 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r287469 | oej | 2010-09-19 17:56:50 +0200 (Sön, 19 Sep 2010) | 7 lines

  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: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@287470 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index 17b4dc37c084d38dfd62734169c4e6b16519b5a1..b1ea5d3743c02bfa78d5a63d34b6e71a89000ad3 100644 (file)
@@ -2449,7 +2449,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;
@@ -2498,6 +2498,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) {
@@ -2549,6 +2552,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;
                }
        }