Skip to content

Commit b6c2883

Browse files
author
Martin Köditz
authored
Merge pull request #30 from KoudelkaB/master
Memory leaks fixed. Thanks to KoudelkaB.
2 parents eb2f5df + 6114855 commit b6c2883

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

ibase_query.c

+11-6
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ static void _php_ibase_free_query(ibase_query *ib_query) /* {{{ */
187187
zend_list_delete(ib_query->stmt_res);
188188
ib_query->stmt_res = NULL;
189189
}
190+
if (ib_query->result_res != NULL) {
191+
zend_list_delete(ib_query->result_res);
192+
ib_query->result_res = NULL;
193+
}
190194
if (ib_query->in_array) {
191195
efree(ib_query->in_array);
192196
}
@@ -1895,13 +1899,14 @@ PHP_FUNCTION(ibase_execute)
18951899
}
18961900

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

1902-
if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_close)) {
1903-
_php_ibase_error();
1904-
break;
1906+
if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_close)) {
1907+
_php_ibase_error();
1908+
break;
1909+
}
19051910
}
19061911
zend_list_delete(ib_query->result_res);
19071912
ib_query->result_res = NULL;

0 commit comments

Comments
 (0)