Skip to content

Commit

Permalink
Fix crash in PDO_ODBC statement dtor (#17586)
Browse files Browse the repository at this point in the history
Port of 2ae897f to PDO_ODBC.
  • Loading branch information
NattyNarwhal authored Jan 27, 2025
1 parent 1a4810a commit 556def7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ext/pdo_odbc/odbc_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ static int odbc_stmt_dtor(pdo_stmt_t *stmt)
{
pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;

if (S->stmt != SQL_NULL_HANDLE) {
// TODO: Factor this out; pg/mysql/firebird do the same thing
bool server_obj_usable = !Z_ISUNDEF(stmt->database_object_handle)
&& IS_OBJ_VALID(EG(objects_store).object_buckets[Z_OBJ_HANDLE(stmt->database_object_handle)])
&& !(OBJ_FLAGS(Z_OBJ(stmt->database_object_handle)) & IS_OBJ_FREE_CALLED);
if (S->stmt != SQL_NULL_HANDLE && server_obj_usable) {
if (stmt->executed) {
SQLCloseCursor(S->stmt);
}
Expand Down

0 comments on commit 556def7

Please sign in to comment.