mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Revert "Revert "Fix memory leak when dereferencing reference with refcount 1""
This reverts commit 7aab9659ee
.
This commit is contained in:
parent
c234ca8e17
commit
40230eef81
1 changed files with 2 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue