Skip to content
Browse files

Issue 264: Parameters leaked if an exception is raised.

  • Loading branch information...
1 parent 7555f7d commit 244e84a3e281f5f3387089ee49868a6fb9ed1ff2 Michael Kleehammer committed
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/cursor.cpp
View
7 src/cursor.cpp
@@ -704,13 +704,18 @@ static PyObject* execute(Cursor* cur, PyObject* pSql, PyObject* params, bool ski
{
// We could try dropping through the while and if below, but if there is an error, we need to raise it before
// FreeParameterData calls more ODBC functions.
- return RaiseErrorFromHandle("SQLExecDirectW", cur->cnxn->hdbc, cur->hstmt);
+ RaiseErrorFromHandle("SQLExecDirectW", cur->cnxn->hdbc, cur->hstmt);
+ FreeParameterData(cur);
+ return 0;
}
while (ret == SQL_NEED_DATA)
{
// We have bound a PyObject* using SQL_LEN_DATA_AT_EXEC, so ODBC is asking us for the data now. We gave the
// PyObject pointer to ODBC in SQLBindParameter -- SQLParamData below gives the pointer back to us.
+ //
+ // Note that we did not increment the pointer reference for this since we are still in the same C function call
+ // that performed the bind.
szLastFunction = "SQLParamData";
PyObject* pParam;

0 comments on commit 244e84a

Please sign in to comment.
Something went wrong with that request. Please try again.