]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_confbridge: Fix memory leak on reload.
authorRichard Mudgett <rmudgett@digium.com>
Thu, 13 Jun 2013 18:47:48 +0000 (18:47 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 13 Jun 2013 18:47:48 +0000 (18:47 +0000)
The config framework options should not be registered multiple times.
Instead the configuration just needs to be reprocessed by the config
framework.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@391700 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_confbridge.c
apps/confbridge/conf_config_parser.c
apps/confbridge/include/confbridge.h

index 73af5a0abb50079ed70953a61d8a1dcfe54f1e07..57de6d46cf4e036961452d20817d6498f45d5976 100644 (file)
@@ -3098,7 +3098,7 @@ static int load_module(void)
 {
        int res = 0;
 
-       if (conf_load_config(0)) {
+       if (conf_load_config()) {
                ast_log(LOG_ERROR, "Unable to load config. Not loading module.\n");
                return AST_MODULE_LOAD_DECLINE;
        }
@@ -3145,7 +3145,7 @@ static int load_module(void)
 
 static int reload(void)
 {
-       return conf_load_config(1);
+       return conf_reload_config();
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Conference Bridge Application",
index 57166aa8c958429a0e5d450d3781b6e54708ec9c..9244a42e05541e9eef011dff22badb0dee288ea4 100644 (file)
@@ -1320,12 +1320,10 @@ static int verify_default_profiles(void)
        return 0;
 }
 
-int conf_load_config(int reload)
+int conf_load_config(void)
 {
-       if (!reload) {
-               if (aco_info_init(&cfg_info)) {
-                       return -1;
-               }
+       if (aco_info_init(&cfg_info)) {
+               return -1;
        }
 
        /* User options */
@@ -1373,23 +1371,29 @@ int conf_load_config(int reload)
        /* Menu options */
        aco_option_register_custom(&cfg_info, "^[0-9A-D*#]+$", ACO_REGEX, menu_types, NULL, menu_option_handler, 0);
 
-       if (aco_process_config(&cfg_info, reload) == ACO_PROCESS_ERROR) {
+       if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
                goto error;
        }
 
-       if (!reload && ast_cli_register_multiple(cli_confbridge_parser, ARRAY_LEN(cli_confbridge_parser))) {
+       if (ast_cli_register_multiple(cli_confbridge_parser, ARRAY_LEN(cli_confbridge_parser))) {
                goto error;
        }
 
        return 0;
 error:
-       /* On a reload, just keep the config we already have in place. */
-       if (!reload) {
-               conf_destroy_config();
-       }
+       conf_destroy_config();
        return -1;
 }
 
+int conf_reload_config(void)
+{
+       if (aco_process_config(&cfg_info, 1) == ACO_PROCESS_ERROR) {
+               /* On a reload, just keep the config we already have in place. */
+               return -1;
+       }
+       return 0;
+}
+
 static void conf_user_profile_copy(struct user_profile *dst, struct user_profile *src)
 {
        *dst = *src;
index 662823e3851f1756a63f8f138e962b01f607950f..0de2c50c9dfaf66110fb5cfc71f3ea25606ab02e 100644 (file)
@@ -244,7 +244,10 @@ struct conference_bridge_user {
 };
 
 /*! \brief load confbridge.conf file */
-int conf_load_config(int reload);
+int conf_load_config(void);
+
+/*! \brief reload confbridge.conf file */
+int conf_reload_config(void);
 
 /*! \brief destroy the information loaded from the confbridge.conf file*/
 void conf_destroy_config(void);