dect
/
asterisk
Archived
13
0
Fork 0

Merged revisions 219136 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r219136 | mnicholson | 2009-09-17 09:58:39 -0500 (Thu, 17 Sep 2009) | 10 lines
  
  Prevent a potential race condition and crash when hanging up a channel by removing the channel from the channel list before begining channel tear down.
  
  This fix may potentially cause problems with CDR backends that access the channel a CDR is associated with via the channel list.  This fix makes the channel unavabile at the time when the CDR backend is invoked.  This has been documented in include/asterisk/cdr.h.
  
  (closes issue #15316)
  Reported by: vmarrone
  Tested by: mnicholson
  
  Review: https://reviewboard.asterisk.org/r/362/
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@219139 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
mnicholson 2009-09-17 15:18:01 +00:00
parent a679fc0bd5
commit 667d2ffb9d
2 changed files with 11 additions and 0 deletions

View File

@ -124,6 +124,12 @@ int ast_cdr_serialize_variables(struct ast_cdr *cdr, struct ast_str **buf, char
void ast_cdr_free_vars(struct ast_cdr *cdr, int recur);
int ast_cdr_copy_vars(struct ast_cdr *to_cdr, struct ast_cdr *from_cdr);
/*!
* \brief CDR backend callback
* \warning CDR backends should NOT attempt to access the channel associated
* with a CDR record. This channel is not guaranteed to exist when the CDR
* backend is invoked.
*/
typedef int (*ast_cdrbe)(struct ast_cdr *cdr);
/*! \brief Return TRUE if CDR subsystem is enabled */

View File

@ -2119,6 +2119,11 @@ int ast_hangup(struct ast_channel *chan)
ast_channel_unlock(chan);
return 0;
}
ast_channel_unlock(chan);
ao2_unlink(channels, chan);
ast_channel_lock(chan);
free_translation(chan);
/* Close audio stream */
if (chan->stream) {