From 77810d32b5266b5a984ac5ea2a82d3fde3e08a02 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Mon, 9 Dec 2024 03:39:46 +0900 Subject: [PATCH] Free thread-safe global ID after allocation Add a call to `ts_free_id(rayaop_globals_id)` immediately after allocating the globals. This ensures proper resource cleanup and prevents potential memory leaks. --- rayaop.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rayaop.c b/rayaop.c index 3b08b98..4fdae83 100644 --- a/rayaop.c +++ b/rayaop.c @@ -370,6 +370,8 @@ PHP_MINIT_FUNCTION(rayaop) { #ifdef ZTS ts_allocate_id(&rayaop_globals_id, sizeof(zend_rayaop_globals), NULL, NULL); rayaop_mutex = tsrm_mutex_alloc(); + ts_free_id(rayaop_globals_id); + if (!rayaop_mutex) { php_error_docref(NULL, E_ERROR, "Failed to allocate mutex for RayAOP"); return FAILURE;