[asterisk-commits] seanbright: branch seanbright/cdr-tds-conversion r124833 - /team/seanbright/c...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jun 23 21:51:26 CDT 2008
Author: seanbright
Date: Mon Jun 23 21:51:25 2008
New Revision: 124833
URL: http://svn.digium.com/view/asterisk?view=rev&rev=124833
Log:
We don't need to keep the LOGINREC around for the duration.
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=124833&r1=124832&r2=124833
==============================================================================
--- team/seanbright/cdr-tds-conversion/cdr/cdr_tds.c (original)
+++ team/seanbright/cdr-tds-conversion/cdr/cdr_tds.c Mon Jun 23 21:51:25 2008
@@ -90,7 +90,6 @@
AST_STRING_FIELD(language);
);
DBPROCESS *dbproc;
- LOGINREC *login;
unsigned int connected:1;
ast_mutex_t lock;
};
@@ -295,11 +294,6 @@
settings->dbproc = NULL;
}
- if (settings->login) {
- dbloginfree(settings->login);
- settings->login = NULL;
- }
-
settings->connected = 0;
return 0;
@@ -307,18 +301,20 @@
static int mssql_connect(void)
{
- if ((settings->login = dblogin()) == NULL) {
+ LOGINREC *login;
+
+ if ((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);
- DBSETLCHARSET(settings->login, settings->charset);
- DBSETLNATLANG(settings->login, settings->language);
-
- if ((settings->dbproc = dbopen(settings->login, (char *) settings->hostname)) == NULL) {
+ DBSETLAPP(login, "TSQL");
+ DBSETLUSER(login, settings->username);
+ DBSETLPWD(login, settings->password);
+ DBSETLCHARSET(login, settings->charset);
+ DBSETLNATLANG(login, settings->language);
+
+ if ((settings->dbproc = dbopen(login, (char *) settings->hostname)) == NULL) {
ast_log(LOG_ERROR, "Unable to connect to %s\n", settings->hostname);
return -1;
}
@@ -327,6 +323,8 @@
ast_log(LOG_ERROR, "Unable to select database %s\n", settings->database);
return -1;
}
+
+ dbloginfree(login);
settings->connected = 1;
More information about the asterisk-commits
mailing list