1
0
mirror of https://github.com/danog/ext-pq.git synced 2024-12-04 10:18:14 +01:00

avoid adding a ref to the object of the iterator actually living inside

that object
This commit is contained in:
Michael Wallner 2014-09-12 07:25:24 +02:00
parent a04c771813
commit 2805a4d1f8

View File

@ -38,7 +38,7 @@ static zend_object_iterator *php_pqres_iterator_init(zend_class_entry *ce, zval
iter = ecalloc(1, sizeof(*iter)); iter = ecalloc(1, sizeof(*iter));
iter->zi.funcs = &php_pqres_iterator_funcs; iter->zi.funcs = &php_pqres_iterator_funcs;
iter->zi.data = object; iter->zi.data = object;
Z_ADDREF_P(object); /* do not addref, because the iterator lives inside this object anyway */
zfetch_type = prop = zend_read_property(ce, object, ZEND_STRL("fetchType"), 0 TSRMLS_CC); zfetch_type = prop = zend_read_property(ce, object, ZEND_STRL("fetchType"), 0 TSRMLS_CC);
if (Z_TYPE_P(zfetch_type) != IS_LONG) { if (Z_TYPE_P(zfetch_type) != IS_LONG) {
@ -66,7 +66,6 @@ static void php_pqres_iterator_dtor(zend_object_iterator *i TSRMLS_DC)
zval_ptr_dtor(&iter->current_val); zval_ptr_dtor(&iter->current_val);
iter->current_val = NULL; iter->current_val = NULL;
} }
zval_ptr_dtor((zval **) &iter->zi.data);
efree(iter); efree(iter);
} }