moh: fix a refcount error with realtime MOH

I observed a crash in res_musiconhold on an Asterisk 11 system using realtime
MOH.  Investigation of the backtrace showed a corrupt mohclass, implying that
it got destroyed before the code expected it to.  I went looking for reference
counting errors that could have caused this crash and this patch this result.
It contains 2 changes.

1) Remove a usless block of code that was impossible to reach.  There was even
a comment indicating that it was impossible to reach.  The conditional includes
"!ast_test_flag(global_flags, MOH_CACHERTCLASSES)" and it's inside of an if
block with the opposite check "ast_test_flag(global_flags,
MOH_CACHERTCLASSES)".  There's no good reason to keep it around.

2) A similar block to #1 contained a reference counting error.  It stores
state->class in the local variable mohclass without increasing its reference
count.  The reference count on mohclass is decremented at the end of the
function.  This block of code probably very rarely runs, which would help
explain why this system was working fine for many months before experiencing a
crash.

Review: https://reviewboard.asterisk.org/r/3282/
........

Merged revisions 410043 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 410044 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 410090 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: http://svn.asterisk.org/svn/asterisk/trunk@410091 f38db490-d61c-443f-a65b-d21fe96a405b
sorcery.c: Fix off-nominal path ref and memory leak in ast_sorcery_objectset_json_create().

* Made exit a loop early on error in ast_sorcery_objectset_json_create().

* Removed some dead code in ast_sorcery_objectset_create2().
........

Merged revisions 410089 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: http://svn.asterisk.org/svn/asterisk/trunk@410092 f38db490-d61c-443f-a65b-d21fe96a405b