Merged revisions 308622 via svnmerge from
authorRichard Mudgett <rmudgett@digium.com>
Wed, 23 Feb 2011 23:45:02 +0000 (23:45 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 23 Feb 2011 23:45:02 +0000 (23:45 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r308622 | rmudgett | 2011-02-23 17:38:04 -0600 (Wed, 23 Feb 2011) | 9 lines

  sig_pri_new_ast_channel() should return NULL when new_ast_channel() fails.

  (closes issue #18874)
  Reported by: cmaj
  Patches:
        patch-sig_pri-crash-possible-null-channel-pointer.diff.txt uploaded by cmaj (license 830)

  JIRA SWP-3172
........

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

channels/sig_pri.c

index 556c7db..05d0fa4 100644 (file)
@@ -884,10 +884,14 @@ static struct ast_channel *sig_pri_new_ast_channel(struct sig_pri_chan *p, int s
 {
        struct ast_channel *c;
 
-       if (p->calls->new_ast_channel)
+       if (p->calls->new_ast_channel) {
                c = p->calls->new_ast_channel(p->chan_pvt, state, ulaw, exten, requestor);
-       else
+       } else {
+               return NULL;
+       }
+       if (!c) {
                return NULL;
+       }
 
        if (!p->owner)
                p->owner = c;