aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
Diffstat (limited to 'res')
-rw-r--r--res/res_musiconhold.c4
1 files changed, 3 insertions, 1 deletions
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);