Fix segfault regression from r370681
authorKinsey Moore <kmoore@digium.com>
Wed, 10 Oct 2012 13:40:40 +0000 (13:40 +0000)
committerKinsey Moore <kmoore@digium.com>
Wed, 10 Oct 2012 13:40:40 +0000 (13:40 +0000)
Due to usage of ast_hook_send_action, AMI action handling code should
be able to handle a NULL mansession->session.  This would cause a crash
on NULL dereference if action_originate was called from
ast_hook_send_action.

(closes issue ASTERISK-20544)
........

Merged revisions 374792 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374793 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index 0a6d962..bb9c359 100644 (file)
@@ -4369,7 +4369,7 @@ static int action_originate(struct mansession *s, const struct message *m)
 
        /* Allocate requested channel variables */
        vars = astman_get_variables(m);
-       if (s->session->chanvars) {
+       if (s->session && s->session->chanvars) {
                struct ast_variable *v, *old;
                old = vars;
                vars = NULL;