diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-12-01 05:27:18 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-12-01 05:27:18 +0000 |
commit | 60023b1d7514688f2260afc8b869534f5ad046d0 (patch) | |
tree | 504a0d1fea78f12367d147173b901a7cbe983012 /cdr | |
parent | 35ac110f0e4a02a1081a174712c3a5a762671de5 (diff) |
Fix missing ast_destroy's in PGSQL (bug #2944)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4365 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr')
-rwxr-xr-x | cdr/cdr_pgsql.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c index ccec5f9e5..f6af7ff58 100755 --- a/cdr/cdr_pgsql.c +++ b/cdr/cdr_pgsql.c @@ -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(); |