]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Ensure that adding a user to the list of users of a specific music on hold
authorRussell Bryant <russell@russellbryant.com>
Fri, 13 Jul 2007 20:07:21 +0000 (20:07 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 13 Jul 2007 20:07:21 +0000 (20:07 +0000)
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

res/res_musiconhold.c

index efdd90bc4ef64cd94d0b3671230c27b654ee669c..f4e3a81677b399ab1e6e1fe4ddd6caa4b5ceeb40 100644 (file)
@@ -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;
 }