]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Because of the way chan_local is written we should be extra careful and make sure...
authorJoshua Colp <jcolp@digium.com>
Thu, 16 Nov 2006 18:26:50 +0000 (18:26 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 16 Nov 2006 18:26:50 +0000 (18:26 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@47750 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_local.c

index 29c856573124bdcae97bfce596e0e15f5a7dcf64..b3bf3b24c5e562781c9e7bdb5feb2cb90ffe2dae 100644 (file)
@@ -168,6 +168,9 @@ static int local_answer(struct ast_channel *ast)
        int isoutbound;
        int res = -1;
 
+       if (!p)
+               return -1;
+
        ast_mutex_lock(&p->lock);
        isoutbound = IS_OUTBOUND(ast, p);
        if (isoutbound) {
@@ -245,6 +248,9 @@ static int local_write(struct ast_channel *ast, struct ast_frame *f)
        int res = -1;
        int isoutbound;
 
+       if (!p)
+               return -1;
+
        /* Just queue for delivery to the other side */
        ast_mutex_lock(&p->lock);
        isoutbound = IS_OUTBOUND(ast, p);
@@ -289,6 +295,9 @@ static int local_indicate(struct ast_channel *ast, int condition)
        struct ast_frame f = { AST_FRAME_CONTROL, };
        int isoutbound;
 
+       if (!p)
+               return -1;
+
        /* Queue up a frame representing the indication as a control frame */
        ast_mutex_lock(&p->lock);
        isoutbound = IS_OUTBOUND(ast, p);
@@ -305,6 +314,9 @@ static int local_digit(struct ast_channel *ast, char digit)
        struct ast_frame f = { AST_FRAME_DTMF, };
        int isoutbound;
 
+       if (!p)
+               return -1;
+
        ast_mutex_lock(&p->lock);
        isoutbound = IS_OUTBOUND(ast, p);
        f.subclass = digit;
@@ -320,6 +332,9 @@ static int local_sendhtml(struct ast_channel *ast, int subclass, const char *dat
        struct ast_frame f = { AST_FRAME_HTML, };
        int isoutbound;
 
+       if (!p)
+               return -1;
+       
        ast_mutex_lock(&p->lock);
        isoutbound = IS_OUTBOUND(ast, p);
        f.subclass = subclass;
@@ -338,6 +353,9 @@ static int local_call(struct ast_channel *ast, char *dest, int timeout)
        int res;
        struct ast_var_t *varptr = NULL, *new;
        size_t len, namelen;
+
+       if (!p)
+               return -1;
        
        ast_mutex_lock(&p->lock);
 
@@ -414,6 +432,9 @@ static int local_hangup(struct ast_channel *ast)
        struct ast_channel *ochan = NULL;
        int glaredetect;
 
+       if (!p)
+               return -1;
+
        ast_mutex_lock(&p->lock);
        isoutbound = IS_OUTBOUND(ast, p);
        if (isoutbound) {