Skip to content

Before freeing stmt in destructor check if dbh driver data is NULL #829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion source/pdo_sqlsrv/pdo_stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,13 @@ int pdo_sqlsrv_stmt_dtor( _Inout_ pdo_stmt_t *stmt TSRMLS_DC )
LOG( SEV_NOTICE, "pdo_sqlsrv_stmt_dtor: entering" );

// if a PDO statement didn't complete preparation, its driver_data can be NULL
if( driver_stmt == NULL ) {
if (driver_stmt == NULL) {
return 1;
}

// occasionally stmt->dbh->driver_data is already freed and reset but its driver_data is not
if (stmt->dbh != NULL && stmt->dbh->driver_data == NULL) {
stmt->driver_data = NULL;
return 1;
}

Expand Down