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; }