mirror of
https://github.com/php/php-src.git
synced 2025-08-16 22:18:50 +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_REFCOUNTED_P(p)) {
|
||||||
if (Z_ISREF_P(p) && Z_REFCOUNT_P(p) == 1) {
|
if (Z_ISREF_P(p) && Z_REFCOUNT_P(p) == 1) {
|
||||||
|
zend_reference *ref = Z_REF_P(p);
|
||||||
ZVAL_COPY(p, Z_REFVAL_P(p));
|
ZVAL_COPY(p, Z_REFVAL_P(p));
|
||||||
|
efree(ref);
|
||||||
} else {
|
} else {
|
||||||
Z_ADDREF_P(p);
|
Z_ADDREF_P(p);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue