mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-18 18:46:16 +00:00
Fix crash during CDR update.
The ast_cdr_setcid() and ast_cdr_update() were shown in ASTERISK-18836 to be called by different threads for the same channel. The channel driver thread and the PBX thread running dialplan. * Add lock protection around CDR API calls that access an ast_channel pointer. (closes issue ASTERISK-18836) Reported by: gpluser Review: https://reviewboard.asterisk.org/r/1628/ ........ Merged revisions 348362 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 348363 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@348364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -684,9 +684,13 @@ static int start_monitor_exec(struct ast_channel *chan, const char *data)
|
||||
if (urlprefix) {
|
||||
snprintf(tmp, sizeof(tmp), "%s/%s.%s", urlprefix, args.fname_base,
|
||||
((strcmp(args.format, "gsm")) ? "wav" : "gsm"));
|
||||
if (!chan->cdr && !(chan->cdr = ast_cdr_alloc()))
|
||||
ast_channel_lock(chan);
|
||||
if (!chan->cdr && !(chan->cdr = ast_cdr_alloc())) {
|
||||
ast_channel_unlock(chan);
|
||||
return -1;
|
||||
}
|
||||
ast_cdr_setuserfield(chan, tmp);
|
||||
ast_channel_unlock(chan);
|
||||
}
|
||||
if (waitforbridge) {
|
||||
/* We must remove the "b" option if listed. In principle none of
|
||||
|
Reference in New Issue
Block a user