Fix memory leak

Fixes oss-fuzz #49272
This commit is contained in:
Dmitry Stogov 2022-07-25 12:04:46 +03:00
parent 3962f00b01
commit 44b86aee31
2 changed files with 22 additions and 0 deletions

View file

@ -5335,6 +5335,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, opline
| FREE_OP op2_type, op2, op2_info, 0, opline
if (may_throw) {

View 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