From f7816736140f3f38d42c922b023191af2d338c67 Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Thu, 16 Nov 2006 18:32:27 +0000 Subject: Merged revisions 47751 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r47751 | file | 2006-11-16 13:29:12 -0500 (Thu, 16 Nov 2006) | 10 lines Merged revisions 47750 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r47750 | file | 2006-11-16 13:26:50 -0500 (Thu, 16 Nov 2006) | 2 lines 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/trunk@47752 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_local.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'channels/chan_local.c') diff --git a/channels/chan_local.c b/channels/chan_local.c index e1028aa1e..e4c7612cf 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -203,6 +203,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) { @@ -276,6 +279,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); @@ -321,6 +327,9 @@ static int local_indicate(struct ast_channel *ast, int condition, const void *da struct ast_frame f = { AST_FRAME_CONTROL, }; int isoutbound; + if (!p) + return -1; + /* If this is an MOH hold or unhold, do it on the Local channel versus real channel */ if (condition == AST_CONTROL_HOLD) { ast_moh_start(ast, data, NULL); @@ -347,6 +356,9 @@ static int local_digit_begin(struct ast_channel *ast, char digit) struct ast_frame f = { AST_FRAME_DTMF_BEGIN, }; int isoutbound; + if (!p) + return -1; + ast_mutex_lock(&p->lock); isoutbound = IS_OUTBOUND(ast, p); f.subclass = digit; @@ -363,6 +375,9 @@ static int local_digit_end(struct ast_channel *ast, char digit) struct ast_frame f = { AST_FRAME_DTMF_END, }; int isoutbound; + if (!p) + return -1; + ast_mutex_lock(&p->lock); isoutbound = IS_OUTBOUND(ast, p); f.subclass = digit; @@ -379,6 +394,9 @@ static int local_sendtext(struct ast_channel *ast, const char *text) struct ast_frame f = { AST_FRAME_TEXT, }; int isoutbound; + if (!p) + return -1; + ast_mutex_lock(&p->lock); isoutbound = IS_OUTBOUND(ast, p); f.data = (char *) text; @@ -395,6 +413,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; @@ -413,6 +434,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); @@ -454,6 +478,9 @@ static int local_hangup(struct ast_channel *ast) struct ast_channel *ochan = NULL; int glaredetect = 0; + if (!p) + return -1; + ast_mutex_lock(&p->lock); isoutbound = IS_OUTBOUND(ast, p); if (isoutbound) { -- cgit v1.2.3