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 b4325d6113
commit 3c65375adb
No known key found for this signature in database
GPG Key ID: 0098C05DD15ABC13
2 changed files with 7 additions and 1 deletions

4
NEWS
View File

@ -26,6 +26,8 @@ PHP NEWS
. Adjusted closure names to include the parent function's name. (timwolla)
. Improve randomness of uploaded file names and files created by tempnam().
(Arnaud)
. Fixed bug GH-14510 (memleak due to missing pthread_attr_destroy()-call).
(Florian Engelhardt)
- Curl:
. Deprecated the CURLOPT_BINARYTRANSFER constant. (divinity76)
@ -196,7 +198,7 @@ PHP NEWS
. Added class Pdo\Pgsql. (danack, kocsismate)
. Retrieve the memory usage of the query result resource. (KentarouTakeda)
. Added Pdo\Pgsql::setNoticeCallBack method to receive DB notices.
(outtersg)
(outtersg)
- PDO_SQLITE:
. Added class Pdo\Sqlite. (danack, kocsismate)

View File

@ -139,6 +139,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;
}
@ -148,6 +149,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;
}
@ -159,6 +161,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) */