diff options
Diffstat (limited to 'channels/chan_local.c')
-rw-r--r-- | channels/chan_local.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c index 84fd9d220..b3bf3b24c 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -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); @@ -263,6 +269,10 @@ static int local_write(struct ast_channel *ast, struct ast_frame *f) static int local_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) { struct local_pvt *p = newchan->tech_pvt; + + if (!p) + return -1; + ast_mutex_lock(&p->lock); if ((p->owner != oldchan) && (p->chan != oldchan)) { @@ -285,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); @@ -301,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; @@ -316,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; @@ -334,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); @@ -410,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) { |