Skip to content

Commit bd522d6

Browse files
authored
Merge pull request #1 from KoudelkaB/KoudelkaB-patch-1
Hardly debugable PHP.exe crashes fixed
2 parents 23e2928 + cc0c93a commit bd522d6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ibase_query.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ static void _php_ibase_free_result(zend_resource *rsrc) /* {{{ */
146146
_php_ibase_free_xsqlda(ib_result->out_sqlda);
147147
if (ib_result->query != NULL) {
148148
IBDEBUG("query still valid; don't drop statement handle");
149-
ib_result->query->result = NULL; /* Indicate to query, that result is released */
149+
if (ib_result->query->result == ib_result) {
150+
/* If we are the last execution result on the query */
151+
ib_result->query->result = NULL; /* Indicate to query, that result is released */
152+
}
150153
} else {
151154
_php_ibase_free_stmt_handle(ib_result->link, ib_result->stmt);
152155
}
@@ -167,7 +170,9 @@ static void _php_ibase_free_query(ibase_query *ib_query) /* {{{ */
167170
}
168171
if (ib_query->result != NULL) {
169172
IBDEBUG("result still valid; don't drop statement handle");
170-
ib_query->result->query = NULL; /* Indicate to result, that query is released */
173+
if (ib_query->result->query == ib_query) {
174+
ib_query->result->query = NULL; /* Indicate to result, that query is released */
175+
}
171176
} else {
172177
_php_ibase_free_stmt_handle(ib_query->link, ib_query->stmt);
173178
}

0 commit comments

Comments
 (0)