From e51a0e25f29e9d4b907bd293965d00ceffa91bee Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Thu, 16 Nov 2006 18:26:50 +0000 Subject: [PATCH] Because of the way chan_local is written we should be extra careful and make sure our callback functions have a tech_pvt. (issue #8275 reported by mflorell) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@47750 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_local.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/channels/chan_local.c b/channels/chan_local.c index 29c8565731..b3bf3b24c5 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); @@ -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) { -- 2.47.2