[asterisk-commits] seanbright: branch seanbright/cdr-tds-conversion r124597 - /team/seanbright/c...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jun 22 09:16:46 CDT 2008


Author: seanbright
Date: Sun Jun 22 09:16:46 2008
New Revision: 124597

URL: http://svn.digium.com/view/asterisk?view=rev&rev=124597
Log:
Move the dblogin call so that we allocate a new LOGINREC before each connect.

Modified:
    team/seanbright/cdr-tds-conversion/cdr/cdr_tds.c

Modified: team/seanbright/cdr-tds-conversion/cdr/cdr_tds.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/cdr-tds-conversion/cdr/cdr_tds.c?view=diff&rev=124597&r1=124596&r2=124597
==============================================================================
--- team/seanbright/cdr-tds-conversion/cdr/cdr_tds.c (original)
+++ team/seanbright/cdr-tds-conversion/cdr/cdr_tds.c Sun Jun 22 09:16:46 2008
@@ -277,6 +277,11 @@
 		settings->dbproc = NULL;
 	}
 
+	if (settings->login) {
+		dbloginfree(settings->login);
+		settings->login = NULL;
+	}
+
 	settings->connected = 0;
 
 	return 0;
@@ -284,6 +289,11 @@
 
 static int mssql_connect(void)
 {
+	if ((settings->login = dblogin()) == NULL) {
+		ast_log(LOG_ERROR, "Unable to allocate login structure for db-lib\n");
+		return -1;
+	}
+
 	DBSETLAPP(settings->login,     "TSQL");
 	DBSETLUSER(settings->login,    settings->username);
 	DBSETLPWD(settings->login,     settings->password);
@@ -379,14 +389,6 @@
 			return 0;
 		}
 
-		if ((settings->login = dblogin()) == NULL) {
-			ast_log(LOG_ERROR, "Unable to allocate login structure for db-lib\n");
-			ast_string_field_free_memory(settings);
-			ast_free(settings);
-			ast_config_destroy(cfg);
-			return 0;
-		}
-
 		ast_mutex_init(&settings->lock);
 	}
 




More information about the asterisk-commits mailing list