diff options
author | David Vossel <dvossel@digium.com> | 2010-06-09 15:09:25 +0000 |
---|---|---|
committer | David Vossel <dvossel@digium.com> | 2010-06-09 15:09:25 +0000 |
commit | e98835e43780e92cced22ad1ae8a66e7f4b7672e (patch) | |
tree | 3da8192f7e97c92c95e2181b94ab7bcfadb59d4f /res/res_musiconhold.c | |
parent | 6d627b8c38a0d1477ff0f376c4c88536953edcce (diff) |
fixes crash in moh when cachertclasses flag is used
The result for moh_register was not verified to guarantee
the mohclass as added to the container.
(closes issue #16993)
Reported by: dmitri
Patches:
res_musiconhold_rtclass2.patch uploaded by dmitri (license 1001)
moh_crash2.diff uploaded by dvossel (license 671)
Tested by: dmitri
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269271 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_musiconhold.c')
-rw-r--r-- | res/res_musiconhold.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 4d2c9ec49..3f2822757 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -1373,7 +1373,10 @@ static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, con * has a pointer to a freed mohclass, so any operations involving the mohclass container would result in reading * invalid memory. */ - moh_register(mohclass, 0, DONT_UNREF); + if (moh_register(mohclass, 0, DONT_UNREF) == -1) { + mohclass = mohclass_unref(mohclass, "unreffing mohclass failed to register"); + return -1; + } } else { /* We don't register RT moh class, so let's init it manualy */ |