[asterisk-commits] rmudgett: branch rmudgett/bridge_phase r391724 - in /team/rmudgett/bridge_pha...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 13 14:41:53 CDT 2013


Author: rmudgett
Date: Thu Jun 13 14:41:52 2013
New Revision: 391724

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391724
Log:
app_agent_pool: 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:
    team/rmudgett/bridge_phase/apps/app_agent_pool.c
    team/rmudgett/bridge_phase/include/asterisk/config_options.h

Modified: team/rmudgett/bridge_phase/apps/app_agent_pool.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/apps/app_agent_pool.c?view=diff&rev=391724&r1=391723&r2=391724
==============================================================================
--- team/rmudgett/bridge_phase/apps/app_agent_pool.c (original)
+++ team/rmudgett/bridge_phase/apps/app_agent_pool.c Thu Jun 13 14:41:52 2013
@@ -464,12 +464,10 @@
 	aco_info_destroy(&cfg_info);
 }
 
-static int load_config(int reload)
-{
-	if (!reload) {
-		if (aco_info_init(&cfg_info)) {
-			return -1;
-		}
+static int load_config(void)
+{
+	if (aco_info_init(&cfg_info)) {
+		return -1;
 	}
 
 	/* Agent options */
@@ -491,17 +489,14 @@
 
 	/*! \todo BUGBUG load_config() needs users.conf handling. */
 
-	if (aco_process_config(&cfg_info, reload) == ACO_PROCESS_ERROR) {
+	if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
 		goto error;
 	}
 
 	return 0;
 
 error:
-	/* On a reload, just keep the config we already have in place. */
-	if (!reload) {
-		destroy_config();
-	}
+	destroy_config();
 	return -1;
 }
 
@@ -513,7 +508,7 @@
 
 static int load_module(void)
 {
-	if (load_config(0)) {
+	if (load_config()) {
 		ast_log(LOG_ERROR, "Unable to load config. Not loading module.\n");
 		return AST_MODULE_LOAD_DECLINE;
 	}
@@ -523,7 +518,11 @@
 
 static int reload(void)
 {
-	return load_config(1);
+	if (aco_process_config(&cfg_info, 1) == ACO_PROCESS_ERROR) {
+		/* Just keep the config we already have in place. */
+		return -1;
+	}
+	return 0;
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Call center agent pool applications",

Modified: team/rmudgett/bridge_phase/include/asterisk/config_options.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/include/asterisk/config_options.h?view=diff&rev=391724&r1=391723&r2=391724
==============================================================================
--- team/rmudgett/bridge_phase/include/asterisk/config_options.h (original)
+++ team/rmudgett/bridge_phase/include/asterisk/config_options.h Thu Jun 13 14:41:52 2013
@@ -458,7 +458,7 @@
 /*! \brief Process a config info via the options registered with an aco_info
  *
  * \param info The config_options_info to be used for handling the config
- * \param reload Whether or not this is a reload
+ * \param reload Non-zero if this is for a reload.
  *
  * \retval ACO_PROCESS_OK Success
  * \retval ACO_PROCESS_ERROR Failure




More information about the asterisk-commits mailing list