mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix memory leak when dereferencing reference with refcount 1
This commit is contained in:
parent
2269b1801d
commit
f4cb5cc09d
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