mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +00:00
app_followme.c: Grab reference on nativeformats before using it
Fixes a crash due to a lack of proper reference on the nativeformats
object before passing it into ast_request(). Also found potentially
similar use case bugs in app_chanisavail.c, bridge.c, and bridge_basic.c
Fixes: #388
(cherry picked from commit 275f7911b5
)
This commit is contained in:
committed by
Asterisk Development Team
parent
52388f11f8
commit
eac9ad69a8
@@ -4118,10 +4118,18 @@ static enum ast_transfer_result blind_transfer_bridge(int is_external,
|
||||
struct ast_channel *local;
|
||||
char chan_name[AST_MAX_EXTENSION + AST_MAX_CONTEXT + 2];
|
||||
int cause;
|
||||
struct ast_format_cap *caps;
|
||||
|
||||
ast_channel_lock(transferer);
|
||||
caps = ao2_bump(ast_channel_nativeformats(transferer));
|
||||
ast_channel_unlock(transferer);
|
||||
|
||||
snprintf(chan_name, sizeof(chan_name), "%s@%s", exten, context);
|
||||
local = ast_request("Local", ast_channel_nativeformats(transferer), NULL, transferer,
|
||||
local = ast_request("Local", caps, NULL, transferer,
|
||||
chan_name, &cause);
|
||||
|
||||
ao2_cleanup(caps);
|
||||
|
||||
if (!local) {
|
||||
return AST_BRIDGE_TRANSFER_FAIL;
|
||||
}
|
||||
@@ -4228,9 +4236,16 @@ static enum ast_transfer_result attended_transfer_bridge(struct ast_channel *cha
|
||||
int cause;
|
||||
int res;
|
||||
const char *app = NULL;
|
||||
struct ast_format_cap *caps;
|
||||
|
||||
ast_channel_lock(chan1);
|
||||
caps = ao2_bump(ast_channel_nativeformats(chan1));
|
||||
ast_channel_unlock(chan1);
|
||||
|
||||
local_chan = ast_request("Local", caps, NULL, chan1, dest, &cause);
|
||||
|
||||
ao2_cleanup(caps);
|
||||
|
||||
local_chan = ast_request("Local", ast_channel_nativeformats(chan1), NULL, chan1,
|
||||
dest, &cause);
|
||||
if (!local_chan) {
|
||||
return AST_BRIDGE_TRANSFER_FAIL;
|
||||
}
|
||||
|
@@ -3293,10 +3293,17 @@ static struct ast_channel *dial_transfer(struct ast_channel *caller, const char
|
||||
{
|
||||
struct ast_channel *chan;
|
||||
int cause;
|
||||
struct ast_format_cap *caps;
|
||||
|
||||
ast_channel_lock(caller);
|
||||
caps = ao2_bump(ast_channel_nativeformats(caller));
|
||||
ast_channel_unlock(caller);
|
||||
|
||||
/* Now we request a local channel to prepare to call the destination */
|
||||
chan = ast_request("Local", ast_channel_nativeformats(caller), NULL, caller, destination,
|
||||
&cause);
|
||||
chan = ast_request("Local", caps, NULL, caller, destination, &cause);
|
||||
|
||||
ao2_cleanup(caps);
|
||||
|
||||
if (!chan) {
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user