mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
Fix a little race condition that could cause a crash if two channels had MOH
stopped at the same time that were using a class that had been marked for deletion when its use count hits zero. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79792 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -202,8 +202,6 @@ static void moh_files_release(struct ast_channel *chan, void *data)
|
||||
{
|
||||
struct moh_files_state *state = chan->music_state;
|
||||
|
||||
ast_atomic_fetchadd_int(&state->class->inuse, -1);
|
||||
|
||||
if (chan && state) {
|
||||
if (chan->stream) {
|
||||
ast_closestream(chan->stream);
|
||||
@@ -217,7 +215,7 @@ static void moh_files_release(struct ast_channel *chan, void *data)
|
||||
}
|
||||
state->save_pos = state->pos;
|
||||
}
|
||||
if (state->class->delete && !state->class->inuse)
|
||||
if (state->class->delete && ast_atomic_dec_and_test(&state->class->inuse))
|
||||
ast_moh_destroy_one(state->class);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user