freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James K. Lowden" <jklowden AT schemamania.org>
- To: TDS Development Group <freetds AT lists.ibiblio.org>
- Subject: [freetds] SQLDisconnect memory leak?
- Date: Mon, 24 May 2004 18:18:55 -0400
[redirected to the list]
Begin forwarded message:
Date: Mon, 24 May 2004 16:26:08 +0800
From: "wangjiangui" <wangjiangui AT mail.newtonecorp.com>
To: <freetds-owner AT lists.ibiblio.org>
Subject: help
i met a very big problem.
i use the UnixODBC2.2.8 and Freetds0.61 to access
the MSSQL.
however,the function SQLConnect(maybe the SQLDisconnect) leads to the
memory leak.
So how can i solve this problem.
thank you.
the follow is my test program:
int db_open()
{
SQLHENV henv;
SQLHDBC hdbc;
SQLRETURN retcode;
SQLAllocHandle( SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv );
SQLSetEnvAttr( henv, SQL_ATTR_ODBC_VERSION,(void *)SQL_OV_ODBC3 ,
0 );
SQLAllocHandle( SQL_HANDLE_DBC, henv, &hdbc );
/* Specify the ODBC Cursor Library is always used then connect. */
retcode = SQLConnect( hdbc, (SQLCHAR *)"test",SQL_NTS,(SQLCHAR
*)"sa",SQL_NTS,(SQLCHAR *)"newtone", SQL
_NTS );
if (!SQL_SUCCEEDED(retcode) || !SQL_SUCCEEDED(retcode)){
SQLFreeHandle( SQL_HANDLE_DBC, hdbc );
SQLFreeHandle( SQL_HANDLE_ENV, henv );
printf("SQLConnect error %d error.\n",retcode);
return 0;
}
retcode = SQLDisconnect( hdbc );
if (!SQL_SUCCEEDED(retcode) || !SQL_SUCCEEDED(retcode)){
printf("SQLDisConnect error %d error.\n",retcode);
}
if (!SQL_SUCCEEDED(retcode) || !SQL_SUCCEEDED(retcode)){
printf("SQLDisConnect error %d error.\n",retcode);
}
SQLFreeHandle( SQL_HANDLE_DBC, hdbc );
if (!SQL_SUCCEEDED(retcode) || !SQL_SUCCEEDED(retcode)){
printf("SQLFree hdbc error %d error.\n",retcode);
}
SQLFreeHandle( SQL_HANDLE_ENV, henv );
if (!SQL_SUCCEEDED(retcode) || !SQL_SUCCEEDED(retcode)){
printf("SQLFree henv error %d error.\n",retcode);
}
printf("SQLFree over.........\n");
return 1;
}
int main()
{
while(1){
printf("*********************************************.\n");
printf("*********************************************.\n");
printf("*********************************************.\n");
struct timeval time_val = {0};
time_val.tv_sec = 0;
time_val.tv_usec = 500000;
select(0, NULL, NULL, NULL, &time_val);
db_open();
}
return 0;
}
-
[freetds] SQLDisconnect memory leak?,
James K. Lowden, 05/24/2004
- Re: [freetds] SQLDisconnect memory leak?, Frediano Ziglio, 05/25/2004
Archive powered by MHonArc 2.6.24.