diff options
author | Mark Michelson <mmichelson@digium.com> | 2009-04-13 19:31:48 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2009-04-13 19:31:48 +0000 |
commit | 0102e6cc44654de468686fbdaf1961be30162b68 (patch) | |
tree | e9b364a7ffbf4438e0b0a592f5d258a9f6000e2c /res/res_musiconhold.c | |
parent | 75dba8ca1d29b6ac8f6af0984b15778e2ebaefb2 (diff) |
Fix another crash related to cached realtime music on hold.
This was another off-by-one problem caused by moh_register.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@188102 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_musiconhold.c')
-rw-r--r-- | res/res_musiconhold.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 01920e087..c1ab05dac 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -1072,7 +1072,9 @@ static int moh_register(struct mohclass *moh, int reload, int unref) if (!mohclass->delete) { ast_log(LOG_WARNING, "Music on Hold class '%s' already exists\n", moh->name); mohclass = mohclass_unref(mohclass, "unreffing mohclass we just found by name"); - moh = mohclass_unref(moh, "unreffing potential new moh class (it is a duplicate)"); + if (unref) { + moh = mohclass_unref(moh, "unreffing potential new moh class (it is a duplicate)"); + } return -1; } mohclass = mohclass_unref(mohclass, "Unreffing mohclass we just found by name"); |