Skip to content

Commit

Permalink
Merge pull request #30 from KoudelkaB/master
Browse files Browse the repository at this point in the history
Memory leaks fixed. Thanks to KoudelkaB.
  • Loading branch information
Martin Köditz authored Mar 3, 2022
2 parents eb2f5df + 6114855 commit b6c2883
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions ibase_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ static void _php_ibase_free_query(ibase_query *ib_query) /* {{{ */
zend_list_delete(ib_query->stmt_res);
ib_query->stmt_res = NULL;
}
if (ib_query->result_res != NULL) {
zend_list_delete(ib_query->result_res);
ib_query->result_res = NULL;
}
if (ib_query->in_array) {
efree(ib_query->in_array);
}
Expand Down Expand Up @@ -1895,13 +1899,14 @@ PHP_FUNCTION(ibase_execute)
}

/* Have we used this cursor before and it's still open (exec proc has no cursor) ? */
if (ib_query->result_res != NULL
&& ib_query->statement_type != isc_info_sql_stmt_exec_procedure) {
IBDEBUG("Implicitly closing a cursor");
if (ib_query->result_res != NULL) {
if (ib_query->statement_type != isc_info_sql_stmt_exec_procedure) {
IBDEBUG("Implicitly closing a cursor");

if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_close)) {
_php_ibase_error();
break;
if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_close)) {
_php_ibase_error();
break;
}
}
zend_list_delete(ib_query->result_res);
ib_query->result_res = NULL;
Expand Down

0 comments on commit b6c2883

Please sign in to comment.