Skip to content

Commit 9dd3e8b

Browse files
committed
JIT: Fixed memory leak in Zend/tests/concat_002.phpt introduced by fac78ee
1 parent 4d4fe76 commit 9dd3e8b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,10 +1369,13 @@ static void ZEND_FASTCALL zend_jit_fast_assign_concat_helper(zval *op1, zval *op
13691369

13701370
do {
13711371
if (Z_REFCOUNTED_P(op1)) {
1372-
if (GC_REFCOUNT(Z_STR_P(op1)) == 1 && EXPECTED(Z_STR_P(op1) != Z_STR_P(op2))) {
1372+
if (GC_REFCOUNT(Z_STR_P(op1)) == 1) {
13731373
result_str = perealloc(Z_STR_P(op1), ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(result_len)), 0);
13741374
ZSTR_LEN(result_str) = result_len;
13751375
zend_string_forget_hash_val(result_str);
1376+
if (UNEXPECTED(Z_STR_P(op1) == Z_STR_P(op2))) {
1377+
ZVAL_NEW_STR(op2, result_str);
1378+
}
13761379
break;
13771380
}
13781381
GC_DELREF(Z_STR_P(op1));

0 commit comments

Comments
 (0)