Skip to content

Commit c5588fa

Browse files
author
Ilia Alshanetsky
committed
Fixed bug #40121 (PDO_DBLIB driver wont free statements).
1 parent a6ff74d commit c5588fa

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ PHP NEWS
44
- Added CURLOPT_TCP_NODELAY constant to Curl extension. (Sara)
55
- Improved proc_open(). Now on Windows it can run external commands not through
66
CMD.EXE. (Dmitry)
7+
- Fixed bug #40121 (PDO_DBLIB driver wont free statements). (Ilia)
78
- Fixed bug #40098 (php_fopen_primary_script() not thread safe). (Ilia)
89
- Fixed bug #40091 (spl_autoload_register with 2 instances of the same
910
class). (Ilia)

ext/pdo_dblib/dblib_stmt.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,17 @@ static int pdo_dblib_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
250250
return 1;
251251
}
252252

253+
static int dblib_mysql_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC)
254+
{
255+
pdo_dblib_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
256+
257+
if (S->rows) {
258+
free_rows(S TSRMLS_CC);
259+
S->rows = NULL;
260+
}
261+
262+
return 1;
263+
}
253264

254265
struct pdo_stmt_methods dblib_stmt_methods = {
255266
pdo_dblib_stmt_dtor,
@@ -261,5 +272,7 @@ struct pdo_stmt_methods dblib_stmt_methods = {
261272
NULL, /* set attr */
262273
NULL, /* get attr */
263274
NULL, /* meta */
275+
NULL, /* nextrow */
276+
dblib_mysql_stmt_cursor_closer
264277
};
265278

0 commit comments

Comments
 (0)