1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 18:22:42 +01:00

Fix memory leak when dereferencing reference with refcount 1

This commit is contained in:
Bob Weinand
2015-01-05 00:28:53 +01:00
parent 2269b1801d
commit f4cb5cc09d

View File

@@ -205,7 +205,9 @@ ZEND_API void zval_add_ref(zval *p)
{
if (Z_REFCOUNTED_P(p)) {
if (Z_ISREF_P(p) && Z_REFCOUNT_P(p) == 1) {
zend_reference *ref = Z_REF_P(p);
ZVAL_COPY(p, Z_REFVAL_P(p));
efree(ref);
} else {
Z_ADDREF_P(p);
}