[asterisk-commits] russell: branch 1.4 r79792 - /branches/1.4/res/res_musiconhold.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Aug 16 17:32:33 CDT 2007
Author: russell
Date: Thu Aug 16 17:32:33 2007
New Revision: 79792
URL: http://svn.digium.com/view/asterisk?view=rev&rev=79792
Log:
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.
Modified:
branches/1.4/res/res_musiconhold.c
Modified: branches/1.4/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/res/res_musiconhold.c?view=diff&rev=79792&r1=79791&r2=79792
==============================================================================
--- branches/1.4/res/res_musiconhold.c (original)
+++ branches/1.4/res/res_musiconhold.c Thu Aug 16 17:32:33 2007
@@ -202,8 +202,6 @@
{
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 @@
}
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);
}
More information about the asterisk-commits
mailing list