[asterisk-commits] rmudgett: branch 11 r391700 - in /branches/11/apps: ./ confbridge/ confbridge...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 13 13:47:49 CDT 2013


Author: rmudgett
Date: Thu Jun 13 13:47:48 2013
New Revision: 391700

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

Modified:
    branches/11/apps/app_confbridge.c
    branches/11/apps/confbridge/conf_config_parser.c
    branches/11/apps/confbridge/include/confbridge.h

Modified: branches/11/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/app_confbridge.c?view=diff&rev=391700&r1=391699&r2=391700
==============================================================================
--- branches/11/apps/app_confbridge.c (original)
+++ branches/11/apps/app_confbridge.c Thu Jun 13 13:47:48 2013
@@ -3098,7 +3098,7 @@
 {
 	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 reload(void)
 {
-	return conf_load_config(1);
+	return conf_reload_config();
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Conference Bridge Application",

Modified: branches/11/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/confbridge/conf_config_parser.c?view=diff&rev=391700&r1=391699&r2=391700
==============================================================================
--- branches/11/apps/confbridge/conf_config_parser.c (original)
+++ branches/11/apps/confbridge/conf_config_parser.c Thu Jun 13 13:47:48 2013
@@ -1320,12 +1320,10 @@
 	return 0;
 }
 
-int conf_load_config(int reload)
-{
-	if (!reload) {
-		if (aco_info_init(&cfg_info)) {
-			return -1;
-		}
+int conf_load_config(void)
+{
+	if (aco_info_init(&cfg_info)) {
+		return -1;
 	}
 
 	/* User options */
@@ -1373,21 +1371,27 @@
 	/* 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)

Modified: branches/11/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/confbridge/include/confbridge.h?view=diff&rev=391700&r1=391699&r2=391700
==============================================================================
--- branches/11/apps/confbridge/include/confbridge.h (original)
+++ branches/11/apps/confbridge/include/confbridge.h Thu Jun 13 13:47:48 2013
@@ -244,7 +244,10 @@
 };
 
 /*! \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);




More information about the asterisk-commits mailing list