mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-03-01 04:25:27 +08:00
Fix memory leak in pthread_getattr_np
* thread.cc (pthread_getattr_np): Fix memory leak, remove usage of malloc for small local buffer. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
77df52e5fc
commit
c173cb0805
@ -1,3 +1,8 @@
|
|||||||
|
2015-10-21 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* thread.cc (pthread_getattr_np): Fix memory leak, remove usage of
|
||||||
|
malloc for small local buffer.
|
||||||
|
|
||||||
2015-10-21 Corinna Vinschen <corinna@vinschen.de>
|
2015-10-21 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* path.cc (symlink_info::check_reparse_point): Don't generate an EIO
|
* path.cc (symlink_info::check_reparse_point): Don't generate an EIO
|
||||||
|
@ -42,3 +42,5 @@ Bug Fixes
|
|||||||
|
|
||||||
- Fix EIO error accessing certain (OS X SMB?) drives
|
- Fix EIO error accessing certain (OS X SMB?) drives
|
||||||
Addresses: https://cygwin.com/ml/cygwin/2015-09/msg00229.html
|
Addresses: https://cygwin.com/ml/cygwin/2015-09/msg00229.html
|
||||||
|
|
||||||
|
- Fix memory leak in calls to pthread_getattr_np.
|
||||||
|
@ -2485,8 +2485,7 @@ pthread::resume (pthread_t *thread)
|
|||||||
extern "C" int
|
extern "C" int
|
||||||
pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
|
pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
|
||||||
{
|
{
|
||||||
const size_t sizeof_tbi = sizeof (THREAD_BASIC_INFORMATION);
|
THREAD_BASIC_INFORMATION tbi;
|
||||||
PTHREAD_BASIC_INFORMATION tbi;
|
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
if (!pthread::is_good_object (&thread))
|
if (!pthread::is_good_object (&thread))
|
||||||
@ -2506,13 +2505,12 @@ pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
|
|||||||
(*attr)->schedparam = thread->attr.schedparam;
|
(*attr)->schedparam = thread->attr.schedparam;
|
||||||
(*attr)->guardsize = thread->attr.guardsize;
|
(*attr)->guardsize = thread->attr.guardsize;
|
||||||
|
|
||||||
tbi = (PTHREAD_BASIC_INFORMATION) malloc (sizeof_tbi);
|
|
||||||
status = NtQueryInformationThread (thread->win32_obj_id,
|
status = NtQueryInformationThread (thread->win32_obj_id,
|
||||||
ThreadBasicInformation,
|
ThreadBasicInformation,
|
||||||
tbi, sizeof_tbi, NULL);
|
&tbi, sizeof (tbi), NULL);
|
||||||
if (NT_SUCCESS (status))
|
if (NT_SUCCESS (status))
|
||||||
{
|
{
|
||||||
PTEB teb = (PTEB) tbi->TebBaseAddress;
|
PTEB teb = (PTEB) tbi.TebBaseAddress;
|
||||||
/* stackaddr holds the uppermost stack address. See the comments
|
/* stackaddr holds the uppermost stack address. See the comments
|
||||||
in pthread_attr_setstack and pthread_attr_setstackaddr for a
|
in pthread_attr_setstack and pthread_attr_setstackaddr for a
|
||||||
description. */
|
description. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user