Skip to content

Commit

Permalink
fix for issue mkleehammer#223 (memory error with db2 driver)
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Schuler committed Apr 11, 2017
1 parent 722c74b commit 0ff4e1a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/getdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static bool ReadVarColumn(Cursor* cur, Py_ssize_t iCol, SQLSMALLINT ctype, bool&
// cbUsed.

Py_ssize_t cbAvailable = cbAllocated - cbUsed;
SQLLEN cbData;
SQLLEN cbData = 0;

Py_BEGIN_ALLOW_THREADS
ret = SQLGetData(cur->hstmt, (SQLUSMALLINT)(iCol+1), ctype, &pb[cbUsed], (SQLLEN)cbAvailable, &cbData);
Expand All @@ -125,7 +125,7 @@ static bool ReadVarColumn(Cursor* cur, Py_ssize_t iCol, SQLSMALLINT ctype, bool&
return false;
}

if (ret == SQL_SUCCESS && cbData < 0)
if (ret == SQL_SUCCESS && (int)cbData < 0)
{
// HACK: FreeTDS 0.91 on OS/X returns -4 for NULL data instead of SQL_NULL_DATA
// (-1). I've traced into the code and it appears to be the result of assigning -1
Expand Down

0 comments on commit 0ff4e1a

Please sign in to comment.