Skip to content

Commit 05809c6

Browse files
committed
Reverted the last change but instead check if dbh driver_data is already freed
1 parent 83d7e59 commit 05809c6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

source/pdo_sqlsrv/pdo_stmt.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,13 @@ int pdo_sqlsrv_stmt_dtor( _Inout_ pdo_stmt_t *stmt TSRMLS_DC )
496496
LOG( SEV_NOTICE, "pdo_sqlsrv_stmt_dtor: entering" );
497497

498498
// if a PDO statement didn't complete preparation, its driver_data can be NULL
499-
if( driver_stmt == NULL ) {
499+
if (driver_stmt == NULL) {
500+
return 1;
501+
}
500502

503+
// if stmt->dbh->driver_data is already freed and but its driver_data is not
504+
if (stmt->dbh != NULL && stmt->dbh->driver_data == NULL) {
505+
stmt->driver_data = NULL;
501506
return 1;
502507
}
503508

@@ -513,10 +518,6 @@ int pdo_sqlsrv_stmt_dtor( _Inout_ pdo_stmt_t *stmt TSRMLS_DC )
513518

514519
stmt->driver_data = NULL;
515520

516-
if (stmt->dbh != NULL) {
517-
stmt->dbh->driver_data = NULL;
518-
}
519-
520521
return 1;
521522
}
522523

0 commit comments

Comments
 (0)