[Asterisk-cvs] asterisk/cdr cdr_pgsql.c,1.10,1.10.2.1

russell at lists.digium.com russell at lists.digium.com
Thu Dec 2 20:17:01 CST 2004


Update of /usr/cvsroot/asterisk/cdr
In directory mongoose.digium.com:/tmp/cvs-serv18308/cdr

Modified Files:
      Tag: v1-0
	cdr_pgsql.c 
Log Message:
add missing config destroy (bug 2944)


Index: cdr_pgsql.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cdr/cdr_pgsql.c,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -d -r1.10 -r1.10.2.1
--- cdr_pgsql.c	28 Jul 2004 18:42:35 -0000	1.10
+++ cdr_pgsql.c	3 Dec 2004 01:15:27 -0000	1.10.2.1
@@ -180,20 +180,13 @@
 	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 @@
 		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 @@
 	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();




More information about the svn-commits mailing list