Skip to content

Commit

Permalink
Before freeing stmt in destructor check if dbh driver data is NULL (#829
Browse files Browse the repository at this point in the history
)

* Issue 434 - set dbh driver data to NULL as well in destructor

* Reverted the last change but instead check if dbh driver_data is already freed

* Modified the comment
  • Loading branch information
yitam authored Aug 10, 2018
1 parent ba9579b commit 909d1fa
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit 909d1fa

Please sign in to comment.