Permalink
Browse files

Fixes #65689. PDO_Firebrid / exec() does not free allocated statement.

  • Loading branch information...
1 parent ac1372d commit e926bf65076cb5c8da6bf8f32635f696de5ff9aa @madorin madorin committed with sgolemon Dec 24, 2016
Showing with 10 additions and 2 deletions.
  1. +10 −2 ext/pdo_firebird/firebird_driver.c
@@ -238,14 +238,16 @@ static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sq
/* execute the statement */
if (isc_dsql_execute2(H->isc_status, &H->tr, &stmt, PDO_FB_SQLDA_VERSION, &in_sqlda, &out_sqlda)) {
RECORD_ERROR(dbh);
- return -1;
+ ret = -1;
+ goto free_statement;
}
/* find out how many rows were affected */
if (isc_dsql_sql_info(H->isc_status, &stmt, sizeof(info_count), const_cast(info_count),
sizeof(result), result)) {
RECORD_ERROR(dbh);
- return -1;
+ ret = -1;
+ goto free_statement;
}
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
RECORD_ERROR(dbh);
}
+free_statement:
+
+ if (isc_dsql_free_statement(H->isc_status, &stmt, DSQL_drop)) {
+ RECORD_ERROR(dbh);
+ }
+
return ret;
}
/* }}} */

0 comments on commit e926bf6

Please sign in to comment.