[asterisk-commits] mmichelson: branch 1.4 r187045 - /branches/1.4/res/res_musiconhold.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 8 11:52:09 CDT 2009


Author: mmichelson
Date: Wed Apr  8 11:52:03 2009
New Revision: 187045

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=187045
Log:
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.


Modified:
    branches/1.4/res/res_musiconhold.c

Modified: branches/1.4/res/res_musiconhold.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/res/res_musiconhold.c?view=diff&rev=187045&r1=187044&r2=187045
==============================================================================
--- branches/1.4/res/res_musiconhold.c (original)
+++ branches/1.4/res/res_musiconhold.c Wed Apr  8 11:52:03 2009
@@ -1219,9 +1219,9 @@
 		}
 
 		/* Don't leak a class when it's already registered */
-		moh_register(class, reload);
-
-		numclasses++;
+		if (!moh_register(class, reload)) {
+			numclasses++;
+		}
 	}
 	
 




More information about the asterisk-commits mailing list