summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2015-01-05 00:28:53 +0100
committerBob Weinand <bobwei9@hotmail.com>2015-01-05 00:28:53 +0100
commitf4cb5cc09d44e6940fecebe52b8013b288ed67c4 (patch)
treef1782a891225774bae9c5da65181906f10ff899c /Zend
parent2269b1801d3e55d6895ff4c066e9f485c1f5ac2f (diff)
downloadphp-git-f4cb5cc09d44e6940fecebe52b8013b288ed67c4.tar.gz
Fix memory leak when dereferencing reference with refcount 1
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend_variables.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
index 56b9b67598..b476bd9f8d 100644
--- a/Zend/zend_variables.c
+++ b/Zend/zend_variables.c
@@ -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);
}