Skip to content

Commit 533737b

Browse files
committed
Merge branch 'PHP-7.1'
* PHP-7.1: Fixes #65689. PDO_Firebrid / exec() does not free allocated statement.
2 parents daa270b + fcd4c34 commit 533737b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ext/pdo_firebird/firebird_driver.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,16 @@ static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sq
238238
/* execute the statement */
239239
if (isc_dsql_execute2(H->isc_status, &H->tr, &stmt, PDO_FB_SQLDA_VERSION, &in_sqlda, &out_sqlda)) {
240240
RECORD_ERROR(dbh);
241-
return -1;
241+
ret = -1;
242+
goto free_statement;
242243
}
243244

244245
/* find out how many rows were affected */
245246
if (isc_dsql_sql_info(H->isc_status, &stmt, sizeof(info_count), const_cast(info_count),
246247
sizeof(result), result)) {
247248
RECORD_ERROR(dbh);
248-
return -1;
249+
ret = -1;
250+
goto free_statement;
249251
}
250252

251253
if (result[0] == isc_info_sql_records) {
@@ -265,6 +267,12 @@ static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sq
265267
RECORD_ERROR(dbh);
266268
}
267269

270+
free_statement:
271+
272+
if (isc_dsql_free_statement(H->isc_status, &stmt, DSQL_drop)) {
273+
RECORD_ERROR(dbh);
274+
}
275+
268276
return ret;
269277
}
270278
/* }}} */

0 commit comments

Comments
 (0)