aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-13 20:07:21 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-13 20:07:21 +0000
commit4f92fbf747b6ee8a7f880671195793963c9bc9cd (patch)
treef608c759c91e7ba69a17e2669814dc8a0b330e91
parent4f5f8b2de563f345f5cfa3db6e0794a34488305b (diff)
Ensure that adding a user to the list of users of a specific music on hold
class is not done at the same time as any of the other operations on this list to prevent list corruption. Using the global moh_data lock for this is not ideal, but it is what is used to protect these lists everywhere else in the module, and I am only changing what is necessary to fix the bug. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@75059 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--res/res_musiconhold.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index efdd90bc4..f4e3a8167 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -660,8 +660,10 @@ static struct mohdata *mohalloc(struct mohclass *cl)
flags = fcntl(moh->pipe[1], F_GETFL);
fcntl(moh->pipe[1], F_SETFL, flags | O_NONBLOCK);
moh->parent = cl;
+ ast_mutex_lock(&moh_lock);
moh->next = cl->members;
cl->members = moh;
+ ast_mutex_unlock(&moh_lock);
return moh;
}