From: Russell Bryant Date: Fri, 13 Jul 2007 20:07:21 +0000 (+0000) Subject: Ensure that adding a user to the list of users of a specific music on hold X-Git-Tag: 1.2.22~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab2a84f41098b85dfadaf2773d9addd32dec9e67;p=thirdparty%2Fasterisk.git 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: https://origsvn.digium.com/svn/asterisk/branches/1.2@75059 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index efdd90bc4e..f4e3a81677 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; }