fix leak
[awesomized/ext-ion] / ion_private.h
index aea7c7de7ec97b54d6404441f128ef901ca3c472..c7212298f935527e19a43b597f10fb0efe616b52 100644 (file)
@@ -2052,9 +2052,13 @@ LOCAL void php_ion_unserialize_object_iface(php_ion_unserializer *ser, zval *ret
                zval *backref = zend_hash_next_index_insert(ser->ids, return_value);
                if (SUCCESS == ce->unserialize(backref, ce, (BYTE *) s->val, s->len, NULL)) {
                        RETVAL_ZVAL(backref, 0, 0);
-               } else if (!EG(exception)) {
-                       zend_throw_exception_ex(spl_ce_UnexpectedValueException, IERR_INTERNAL_ERROR,
-                                       "Failed to unserialize class %s", ce->name->val);
+               } else {
+                       zval_ptr_dtor(backref);
+                       ZVAL_NULL(backref);
+                       if (!EG(exception)) {
+                               zend_throw_exception_ex(spl_ce_UnexpectedValueException, IERR_INTERNAL_ERROR,
+                                                                               "Failed to unserialize class %s", ce->name->val);
+                       }
                }
                zend_string_release(s);
        } else {