From bcc5d268f6b90be3964b6d64e19bf71b6110f0c4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 9 Jan 2023 07:50:30 +0100 Subject: [PATCH] ext/opcache/jit/zend_jit_trace: fix memory leak in _compile_root_trace() (#10146) A copy of this piece of code exists in zend_jit_compile_side_trace(), but there, the leak bug does not exist. This bug exists since both copies of this piece of code were added in commit 4bf2d09edeb14 --- ext/opcache/jit/zend_jit_trace.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 56b01e7daca..555a868b2d5 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -7114,6 +7114,7 @@ static zend_jit_trace_stop zend_jit_compile_root_trace(zend_jit_trace_rec *trace if (t->stack_map_size) { zend_jit_trace_stack *shared_stack_map = (zend_jit_trace_stack*)zend_shared_alloc(t->stack_map_size * sizeof(zend_jit_trace_stack)); if (!shared_stack_map) { + efree(t->stack_map); ret = ZEND_JIT_TRACE_STOP_NO_SHM; goto exit; }