]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 187046 via svnmerge from
authorMark Michelson <mmichelson@digium.com>
Wed, 8 Apr 2009 16:53:26 +0000 (16:53 +0000)
committerMark Michelson <mmichelson@digium.com>
Wed, 8 Apr 2009 16:53:26 +0000 (16:53 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

................
  r187046 | mmichelson | 2009-04-08 11:52:20 -0500 (Wed, 08 Apr 2009) | 16 lines

  Merged revisions 187045 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.4

  ........
    r187045 | mmichelson | 2009-04-08 11:52:03 -0500 (Wed, 08 Apr 2009) | 10 lines

    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.6.1@187048 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_musiconhold.c

index 0a7e05683f76210036e332acd695f51a050a6fc4..fc946291c1040def04faf08d220a9fafb20c05f6 100644 (file)
@@ -1494,9 +1494,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++;
+               }
        }
 
        ast_config_destroy(cfg);