1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

fix memleak due to missing pthread_attr_destroy()-call

Closes GH-14510
This commit is contained in:
Florian Engelhardt
2024-06-08 18:51:46 +02:00
committed by Arnaud Le Blanc
parent 82e6040cff
commit 159f14c45f
2 changed files with 6 additions and 0 deletions

2
NEWS
View File

@@ -10,6 +10,8 @@ PHP NEWS
values during Generator->throw()). (Bob)
. Fixed bug GH-14456 (Attempting to initialize class with private constructor
calls destructor). (Girgias)
. Fixed bug GH-14510 (memleak due to missing pthread_attr_destroy()-call).
(Florian Engelhardt)
- BCMatch:
. Fixed bug (bcpowmod() with mod = -1 returns 1 when it must be 0). (Girgias)

View File

@@ -124,6 +124,7 @@ static bool zend_call_stack_get_linux_pthread(zend_call_stack *stack)
error = pthread_attr_getstack(&attr, &addr, &max_size);
if (error) {
pthread_attr_destroy(&attr);
return false;
}
@@ -133,6 +134,7 @@ static bool zend_call_stack_get_linux_pthread(zend_call_stack *stack)
/* In glibc prior to 2.8, addr and size include the guard pages */
error = pthread_attr_getguardsize(&attr, &guard_size);
if (error) {
pthread_attr_destroy(&attr);
return false;
}
@@ -144,6 +146,8 @@ static bool zend_call_stack_get_linux_pthread(zend_call_stack *stack)
stack->base = (int8_t*)addr + max_size;
stack->max_size = max_size;
pthread_attr_destroy(&attr);
return true;
}
# else /* defined(HAVE_PTHREAD_GETATTR_NP) && defined(HAVE_PTHREAD_ATTR_GETSTACK) */