Skip to content

Commit

Permalink
JIT: Fixed memory leak in Zend/tests/concat_002.phpt introduced by fa…
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Nov 17, 2021
1 parent 4d4fe76 commit 9dd3e8b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ext/opcache/jit/zend_jit_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1369,10 +1369,13 @@ static void ZEND_FASTCALL zend_jit_fast_assign_concat_helper(zval *op1, zval *op

do {
if (Z_REFCOUNTED_P(op1)) {
if (GC_REFCOUNT(Z_STR_P(op1)) == 1 && EXPECTED(Z_STR_P(op1) != Z_STR_P(op2))) {
if (GC_REFCOUNT(Z_STR_P(op1)) == 1) {
result_str = perealloc(Z_STR_P(op1), ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(result_len)), 0);
ZSTR_LEN(result_str) = result_len;
zend_string_forget_hash_val(result_str);
if (UNEXPECTED(Z_STR_P(op1) == Z_STR_P(op2))) {
ZVAL_NEW_STR(op2, result_str);
}
break;
}
GC_DELREF(Z_STR_P(op1));
Expand Down

0 comments on commit 9dd3e8b

Please sign in to comment.