mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Merge branch 'PHP-8.1'
* PHP-8.1: Fix memory leak
This commit is contained in:
commit
4227fddf4d
@ -4928,6 +4928,10 @@ static int zend_jit_long_math_helper(dasm_State **Dst,
|
||||
} else {
|
||||
ZEND_UNREACHABLE();
|
||||
}
|
||||
if (op1_addr == res_addr && (op2_info & MAY_BE_RCN)) {
|
||||
/* compound assignment may decrement "op2" refcount */
|
||||
op2_info |= MAY_BE_RC1;
|
||||
}
|
||||
| FREE_OP op1_type, op1, op1_info, 0, NULL, ZREG_TMP1, ZREG_TMP2
|
||||
| FREE_OP op2_type, op2, op2_info, 0, NULL, ZREG_TMP1, ZREG_TMP2
|
||||
if (may_throw) {
|
||||
|
@ -5423,6 +5423,10 @@ static int zend_jit_long_math_helper(dasm_State **Dst,
|
||||
|.if not(X64)
|
||||
| add r4, 12
|
||||
|.endif
|
||||
if (op1_addr == res_addr && (op2_info & MAY_BE_RCN)) {
|
||||
/* compound assignment may decrement "op2" refcount */
|
||||
op2_info |= MAY_BE_RC1;
|
||||
}
|
||||
| FREE_OP op1_type, op1, op1_info, 0, NULL
|
||||
| FREE_OP op2_type, op2, op2_info, 0, NULL
|
||||
if (may_throw) {
|
||||
|
18
ext/opcache/tests/jit/and_002.phpt
Normal file
18
ext/opcache/tests/jit/and_002.phpt
Normal file
@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
JIT BW_AND: 002 (memory leak)
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.jit_buffer_size=1M
|
||||
--FILE--
|
||||
<?php
|
||||
function t($a) {
|
||||
for($i = 0; $i < 2; $i++)
|
||||
$a &= $a = $a;
|
||||
}
|
||||
t("");
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
DONE
|
Loading…
Reference in New Issue
Block a user