Skip to content

Commit 3c65375

Browse files
realFlowControlarnaud-lb
authored andcommitted
fix memleak due to missing pthread_attr_destroy()-call
Closes GH-14510
1 parent b4325d6 commit 3c65375

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

NEWS

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ PHP NEWS
2626
. Adjusted closure names to include the parent function's name. (timwolla)
2727
. Improve randomness of uploaded file names and files created by tempnam().
2828
(Arnaud)
29+
. Fixed bug GH-14510 (memleak due to missing pthread_attr_destroy()-call).
30+
(Florian Engelhardt)
2931

3032
- Curl:
3133
. Deprecated the CURLOPT_BINARYTRANSFER constant. (divinity76)
@@ -196,7 +198,7 @@ PHP NEWS
196198
. Added class Pdo\Pgsql. (danack, kocsismate)
197199
. Retrieve the memory usage of the query result resource. (KentarouTakeda)
198200
. Added Pdo\Pgsql::setNoticeCallBack method to receive DB notices.
199-
(outtersg)
201+
(outtersg)
200202

201203
- PDO_SQLITE:
202204
. Added class Pdo\Sqlite. (danack, kocsismate)

Zend/zend_call_stack.c

+4
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ static bool zend_call_stack_get_linux_pthread(zend_call_stack *stack)
139139

140140
error = pthread_attr_getstack(&attr, &addr, &max_size);
141141
if (error) {
142+
pthread_attr_destroy(&attr);
142143
return false;
143144
}
144145

@@ -148,6 +149,7 @@ static bool zend_call_stack_get_linux_pthread(zend_call_stack *stack)
148149
/* In glibc prior to 2.8, addr and size include the guard pages */
149150
error = pthread_attr_getguardsize(&attr, &guard_size);
150151
if (error) {
152+
pthread_attr_destroy(&attr);
151153
return false;
152154
}
153155

@@ -159,6 +161,8 @@ static bool zend_call_stack_get_linux_pthread(zend_call_stack *stack)
159161
stack->base = (int8_t*)addr + max_size;
160162
stack->max_size = max_size;
161163

164+
pthread_attr_destroy(&attr);
165+
162166
return true;
163167
}
164168
# else /* defined(HAVE_PTHREAD_GETATTR_NP) && defined(HAVE_PTHREAD_ATTR_GETSTACK) */

0 commit comments

Comments
 (0)