[asterisk-commits] mmichelson: trunk r391676 - /trunk/main/features_config.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jun 13 13:17:15 CDT 2013
Author: mmichelson
Date: Thu Jun 13 13:17:13 2013
New Revision: 391676
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391676
Log:
Fix memory leak in features_config.c
The options should not be registered multiple times. Instead, the configuration just needs
to be reprocessed by the config framework. This also exposed that we were not properly telling
the config framework to treat the configuration processing with the "reload" semantics when
a reload occurred. Both of these errors are fixed now.
Thanks to Richard Mudgett for discovering the leak.
Modified:
trunk/main/features_config.c
Modified: trunk/main/features_config.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/features_config.c?view=diff&rev=391676&r1=391675&r2=391676
==============================================================================
--- trunk/main/features_config.c (original)
+++ trunk/main/features_config.c Thu Jun 13 13:17:13 2013
@@ -1345,9 +1345,9 @@
.write = featuremap_write
};
-static int load_config(int reload)
-{
- if (!reload && aco_info_init(&cfg_info)) {
+static int load_config(void)
+{
+ if (aco_info_init(&cfg_info)) {
ast_log(LOG_ERROR, "Unable to initialize configuration info for features\n");
return -1;
}
@@ -1441,10 +1441,8 @@
if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
ast_log(LOG_ERROR, "Failed to process features.conf configuration!\n");
- if (!reload) {
- aco_info_destroy(&cfg_info);
- ao2_global_obj_release(globals);
- }
+ aco_info_destroy(&cfg_info);
+ ao2_global_obj_release(globals);
return -1;
}
@@ -1559,14 +1557,17 @@
int ast_features_config_reload(void)
{
- return load_config(1);
+ if (aco_process_config(&cfg_info, 1) == ACO_PROCESS_ERROR) {
+ return -1;
+ }
+ return load_config();
}
int ast_features_config_init(void)
{
int res;
- res = load_config(0);
+ res = load_config();
res |= __ast_custom_function_register(&feature_function, NULL);
res |= __ast_custom_function_register(&featuremap_function, NULL);
res |= ast_cli_register_multiple(cli_features_config, ARRAY_LEN(cli_features_config));
More information about the asterisk-commits
mailing list