diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 3d494dfe38..e0ebb40ec2 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -1931,6 +1931,7 @@ static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, con if (mohclass->answeredonly && (ast_channel_state(chan) != AST_STATE_UP)) { ast_verb(3, "The channel '%s' is not answered yet. Ignore the moh request.\n", ast_channel_name(chan)); + mohclass = mohclass_unref(mohclass, "unreffing local reference to mohclass (channel not answered)"); return -1; }