From: Mark Michelson Date: Wed, 8 Apr 2009 16:52:03 +0000 (+0000) Subject: Fix a small logical error when loading moh classes. X-Git-Tag: 1.4.25-rc1~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89d04eef98cd8b72fcc3cffae437b95be649f15e;p=thirdparty%2Fasterisk.git Fix a small logical error when loading moh classes. We were unconditionally incrementing the number of mohclasses registered. However, we should actually only increment if the call to moh_register was successful. While this probably has never caused problems, I noticed it and decided to fix it anyway. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@187045 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 95fe16ec2a..33f258dc0a 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -1219,9 +1219,9 @@ static int load_moh_classes(int reload) } /* Don't leak a class when it's already registered */ - moh_register(class, reload); - - numclasses++; + if (!moh_register(class, reload)) { + numclasses++; + } }