Skip to content

Commit 229e80c

Browse files
committed
Fix memory leak
This fixes oss-fuzz #48051
1 parent e330f44 commit 229e80c

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

ext/opcache/Optimizer/block_pass.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
295295
src->opcode != ZEND_FETCH_STATIC_PROP_R &&
296296
src->opcode != ZEND_FETCH_DIM_R &&
297297
src->opcode != ZEND_FETCH_OBJ_R &&
298-
src->opcode != ZEND_NEW) {
298+
src->opcode != ZEND_NEW &&
299+
src->opcode != ZEND_FETCH_THIS) {
299300
src->result_type = IS_UNUSED;
300301
MAKE_NOP(opline);
301302
++(*opt_count);

ext/opcache/tests/opt/inline_001.phpt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Fuction inlining 001: FETCH_THIS is incompatible with unused result
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--FILE--
8+
<?php
9+
class Foo {
10+
function __construct() {
11+
Some::foo($this);
12+
}
13+
}
14+
class Some {
15+
static function foo() {
16+
}
17+
}
18+
new Foo;
19+
?>
20+
DONE
21+
--EXPECT--
22+
DONE

0 commit comments

Comments
 (0)