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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user