]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
add missing config destroy (bug 2944)
authorRussell Bryant <russell@russellbryant.com>
Fri, 3 Dec 2004 01:15:27 +0000 (01:15 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 3 Dec 2004 01:15:27 +0000 (01:15 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@4378 65c4cc65-6c06-0410-ace0-fbb531ad65f3

CHANGES
cdr/cdr_pgsql.c

diff --git a/CHANGES b/CHANGES
index 804c475df3f5fe6f8a4a6a7eb51ac105e3c210cd..5ead87309ea17b014b8c79116cd818a738f0154f 100755 (executable)
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,8 @@
     -- fix bug with supervised transfers
  -- chan_h323
     -- fix compilation problem
+ -- cdr_pgsql
+    -- fix memory leak when reading config
  -- Numerous other minor bug fixes
 Asterisk 1.0.2
  -- Major bugfix release
index ccec5f9e57f06fdab19affb6697a21a999afc255..f6af7ff5846d71a7d3dea392872aed5c8de56e06 100755 (executable)
@@ -180,20 +180,13 @@ static int my_unload_module(void)
        return 0;
 }
 
-static int my_load_module(void)
+static int process_my_load_module(struct ast_config *cfg)
 {
        int res;
-       struct ast_config *cfg;
        struct ast_variable *var;
         char *pgerror;
        char *tmp;
 
-       cfg = ast_load(config);
-       if (!cfg) {
-               ast_log(LOG_WARNING, "Unable to load config for PostgreSQL CDR's: %s\n", config);
-               return 0;
-       }
-       
        var = ast_variable_browse(cfg, "global");
        if (!var) {
                /* nothing configured */
@@ -280,8 +273,6 @@ static int my_load_module(void)
                pgdbport = "5432";
        }
 
-       ast_destroy(cfg);
-
        ast_log(LOG_DEBUG,"cdr_pgsql: got hostname of %s\n",pghostname);
        ast_log(LOG_DEBUG,"cdr_pgsql: got port of %s\n",pgdbport);
        if (pgdbsock)
@@ -308,6 +299,20 @@ static int my_load_module(void)
        return res;
 }
 
+static int my_load_module(void)
+{
+       struct ast_config *cfg;
+       int res;
+       cfg = ast_load(config);
+       if (!cfg) {
+               ast_log(LOG_WARNING, "Unable to load config for PostgreSQL CDR's: %s\n", config);
+               return 0;
+       }
+       res = process_my_load_module(cfg);
+       ast_destroy(cfg);
+       return res;
+}
+
 int load_module(void)
 {
        return my_load_module();