Changeset: 0606e4aac08a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0606e4aac08a
Modified Files:
clients/odbc/driver/SQLGetConnectAttr.c
Branch: default
Log Message:
Only malloc a new buffer if a positive length is specified.
diffs (33 lines):
diff --git a/clients/odbc/driver/SQLGetConnectAttr.c
b/clients/odbc/driver/SQLGetConnectAttr.c
--- a/clients/odbc/driver/SQLGetConnectAttr.c
+++ b/clients/odbc/driver/SQLGetConnectAttr.c
@@ -84,7 +84,7 @@ MNDBGetConnectAttr(ODBCDbc *dbc,
break;
case SQL_ATTR_CURRENT_CATALOG: /* SQLCHAR* */
/* SQL_CURRENT_QUALIFIER */
- /* MonetDB does NOT support SQL catalog concept, return empty
string */
+ /* MonetDB does NOT support SQL catalog qualifier, return empty
string */
if (BufferLength <= 0) {
/* Invalid string or buffer length */
addDbcError(dbc, "HY090", NULL, 0);
@@ -210,11 +210,15 @@ SQLGetConnectAttrW(SQLHDBC ConnectionHan
switch (Attribute) {
/* all string attributes */
case SQL_ATTR_CURRENT_CATALOG:
- ptr = malloc(BufferLength);
- if (ptr == NULL) {
- /* Memory allocation error */
- addDbcError(dbc, "HY001", NULL, 0);
- return SQL_ERROR;
+ case SQL_ATTR_TRACEFILE:
+ case SQL_ATTR_TRANSLATE_LIB:
+ if (BufferLength > 0) {
+ ptr = malloc(BufferLength);
+ if (ptr == NULL) {
+ /* Memory allocation error */
+ addDbcError(dbc, "HY001", NULL, 0);
+ return SQL_ERROR;
+ }
}
break;
default:
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]