From d6ae36919101edc3f7a60ac2c22f95953cdbf8f6 Mon Sep 17 00:00:00 2001 From: mmichelson Date: Mon, 13 Apr 2009 19:32:43 +0000 Subject: Merged revisions 188102 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r188102 | mmichelson | 2009-04-13 14:31:48 -0500 (Mon, 13 Apr 2009) | 5 lines Fix another crash related to cached realtime music on hold. This was another off-by-one problem caused by moh_register. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@188103 f38db490-d61c-443f-a65b-d21fe96a405b --- res/res_musiconhold.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'res') diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index d64c5d8c0..97553ec6f 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -1090,7 +1090,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); - moh = mohclass_unref(moh); + if (unref) { + moh = mohclass_unref(moh); + } return -1; } mohclass = mohclass_unref(mohclass); -- cgit v1.2.3