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

* 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
This commit is contained in:
Jenny Tam 2018-08-10 15:18:08 -07:00 committed by GitHub
parent ba9579b504
commit 909d1fa130
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}