mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 19:28:53 +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 b5c31b55c9
)
This commit is contained in:
committed by
Asterisk Development Team
parent
04764945cf
commit
8c71aefa04
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user