Memory leaks fix
[asterisk/asterisk.git] / main / stasis_config.c
index 2c450ba..349d415 100644 (file)
@@ -70,7 +70,7 @@ struct stasis_conf {
        struct stasis_threadpool_conf *threadpool;
 };
 
-/*! \brief Mapping of the stasis http conf struct's globals to the
+/*! \brief Mapping of the stasis conf struct's globals to the
  *         threadpool context in the config file. */
 static struct aco_type threadpool_option = {
         .type = ACO_GLOBAL,
@@ -152,18 +152,19 @@ static int process_config(int reload)
 {
        RAII_VAR(struct stasis_conf *, conf, conf_alloc(), ao2_cleanup);
 
-               switch (aco_process_config(&cfg_info, reload)) {
-               case ACO_PROCESS_ERROR:
-                       if (conf && !reload && !aco_set_defaults(&threadpool_option, "threadpool", conf->threadpool)) {
-                               ast_log(AST_LOG_NOTICE, "Failed to process Stasis configuration; using defaults\n");
-                               ao2_global_obj_replace(confs, conf);
-                               return 0;
-                       }
-                       return -1;
-               case ACO_PROCESS_OK:
-               case ACO_PROCESS_UNCHANGED:
-                       break;
+       switch (aco_process_config(&cfg_info, reload)) {
+       case ACO_PROCESS_ERROR:
+               if (conf && !reload
+                       && !aco_set_defaults(&threadpool_option, "threadpool", conf->threadpool)) {
+                       ast_log(AST_LOG_NOTICE, "Failed to process Stasis configuration; using defaults\n");
+                       ao2_global_obj_replace(confs, conf);
+                       return 0;
                }
+               return -1;
+       case ACO_PROCESS_OK:
+       case ACO_PROCESS_UNCHANGED:
+               break;
+       }
 
        return 0;
 }
@@ -171,6 +172,7 @@ static int process_config(int reload)
 static void config_exit(void)
 {
        aco_info_destroy(&cfg_info);
+       ao2_global_obj_release(confs);
 }
 
 int stasis_config_init(void)