@@ -81,6 +81,11 @@ static void _php_ibase_free_query(ibase_query *ib_query) /* {{{ */
8181{
8282 IBDEBUG ("Freeing query..." );
8383
84+ if (ib_query -> stmt ) {
85+ ISC_STATUS_ARRAY status ;
86+ isc_dsql_free_statement (status , & ib_query -> stmt , DSQL_drop );
87+ }
88+
8489 if (ib_query -> out_nullind )efree (ib_query -> out_nullind );
8590 if (ib_query -> bind_buf )efree (ib_query -> bind_buf );
8691 if (ib_query -> in_sqlda )efree (ib_query -> in_sqlda ); // Note to myself: no need for _php_ibase_free_xsqlda()
@@ -1173,6 +1178,8 @@ PHP_FUNCTION(ibase_query)
11731178
11741179 ib_query -> was_result_once = 1 ;
11751180
1181+ zend_list_delete (ib_query -> res );
1182+
11761183 return ;
11771184 }
11781185
@@ -1754,7 +1761,7 @@ PHP_FUNCTION(ibase_prepare)
17541761 }
17551762
17561763 RETVAL_RES (ib_query -> res );
1757- Z_TRY_ADDREF_P (return_value );
1764+ // Z_TRY_ADDREF_P(return_value);
17581765}
17591766/* }}} */
17601767
@@ -1781,6 +1788,10 @@ PHP_FUNCTION(ibase_execute)
17811788 // was do {
17821789 _php_ibase_exec (INTERNAL_FUNCTION_PARAM_PASSTHRU , ib_query , args , bind_n );
17831790
1791+ if (Z_TYPE_P (return_value ) == IS_RESOURCE ) {
1792+ Z_TRY_ADDREF_P (return_value );
1793+ }
1794+
17841795 /* free the query if trans handle was released */
17851796 // if (ib_query->trans->handle == 0) {
17861797 // zend_list_delete(Z_RES_P(query));
0 commit comments