SQLDriverConnect leaks memory on failure - by kertj1

Status : 

  Not Reproducible<br /><br />
		The product team could not reproduce this item with the description and steps provided.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 767248 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 10/12/2012 1:17:59 PM
Access Restriction Public

Description

Hi,
 
I'm using the (newly released) Microsoft ODBC driver for Linux:
   "Driver=SQL Server Native Client 11.0"
   Specifically: sqlncli-11.0.1790.0.tar.gz
 
I am using the Linux tool "valgrind" on a small test program that
 just tries to establish a database connection and then disconnects,
 for example:
 
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &h_env);
 SQLSetEnvAttr(h_env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER*)SQL_OV_ODBC3, 0);
 SQLAllocHandle(SQL_HANDLE_DBC, h_env, &h_dbc);
 SQLDriverConnect(h_dbc, NULL, ...
 SQLDisconnect(h_dbc);
 SQLFreeHandle(SQL_HANDLE_DBC, h_dbc);
 SQLFreeHandle(SQL_HANDLE_ENV, h_env);
 
When the call to SQLDriverConnect is successful, valgrind reports
 that no memory has been leaked.
 
When the call to SQLDriverConnect fails for whatever reason
 (for example: database offline, host down, etc...), each call
 to SQLDriverConnect leaks 1034 bytes of memory.
 
I have tried invoking SQLGetDiagRec() to free the memory but that didn't help.
 
Any suggestions on how to avoid the memory leak?
 
Thanks,
 Kert
Sign in to post a comment.
Posted by Microsoft on 4/15/2013 at 4:21 PM
Thanks for your feedback. Unfortunately we are not able to reproduce the issue.