summaryrefslogtreecommitdiff
path: root/apps/confbridge
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2013-06-13 19:04:41 +0000
committerRichard Mudgett <rmudgett@digium.com>2013-06-13 19:04:41 +0000
commit0e2a9d07aca94409726c1fa34eda9586fd99e176 (patch)
treee746e82f756d2c6c2309f1df4c61af41f9d5b1d6 /apps/confbridge
parentcc06020f23fd175061a65a36c8b6809feca0cc18 (diff)
app_confbridge: Fix memory leak on reload.
The config framework options should not be registered multiple times. Instead the configuration just needs to be reprocessed by the config framework. ........ Merged revisions 391700 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391701 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/confbridge')
-rw-r--r--apps/confbridge/conf_config_parser.c26
-rw-r--r--apps/confbridge/include/confbridge.h5
2 files changed, 19 insertions, 12 deletions
diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c
index 6cec25522..042968c59 100644
--- a/apps/confbridge/conf_config_parser.c
+++ b/apps/confbridge/conf_config_parser.c
@@ -1889,12 +1889,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 */
@@ -1944,23 +1942,29 @@ int conf_load_config(int reload)
aco_option_register(&cfg_info, "type", ACO_EXACT, menu_types, NULL, OPT_NOOP_T, 0, 0);
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;
diff --git a/apps/confbridge/include/confbridge.h b/apps/confbridge/include/confbridge.h
index 1af621dd8..60b2eab87 100644
--- a/apps/confbridge/include/confbridge.h
+++ b/apps/confbridge/include/confbridge.h
@@ -247,7 +247,10 @@ struct confbridge_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);