summaryrefslogtreecommitdiff
path: root/Zend/zend_operators.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-09-26 13:45:45 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-09-26 13:45:45 +0200
commitab938d7bbc3c738337e3c76c2a9c2f676e4fb16e (patch)
treefc5132f2976ea76348800a27999f31b8930bf7f1 /Zend/zend_operators.c
parent8a9df8859747abaf70e4465d066adbe1f97d1fdb (diff)
downloadphp-git-ab938d7bbc3c738337e3c76c2a9c2f676e4fb16e.tar.gz
Fix memory leak with ** on array operands
Diffstat (limited to 'Zend/zend_operators.c')
-rw-r--r--Zend/zend_operators.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 7f1e426e83..584d5d8910 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -1128,12 +1128,18 @@ ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {
if (EXPECTED(op1 != op2)) {
if (Z_TYPE_P(op1) == IS_ARRAY) {
+ if (op1 == result) {
+ zval_ptr_dtor(result);
+ }
ZVAL_LONG(result, 0);
return SUCCESS;
} else {
zendi_convert_scalar_to_number(op1, op1_copy, result, 0);
}
if (Z_TYPE_P(op2) == IS_ARRAY) {
+ if (op1 == result) {
+ zval_ptr_dtor(result);
+ }
ZVAL_LONG(result, 1L);
return SUCCESS;
} else {
@@ -1141,6 +1147,9 @@ ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {
}
} else {
if (Z_TYPE_P(op1) == IS_ARRAY) {
+ if (op1 == result) {
+ zval_ptr_dtor(result);
+ }
ZVAL_LONG(result, 0);
return SUCCESS;
} else {