Skip to content

Commit

Permalink
Free thread-safe global ID after allocation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
koriym committed Dec 8, 2024
1 parent 1af55cc commit 77810d3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rayaop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 77810d3

Please sign in to comment.