From a12267ea336cd7f14e725b1162dad4ec47c278ab Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 24 Oct 2012 07:18:03 +0400 Subject: [PATCH] Fix pthread_attr_t resource leak in pthread_create * pthread_support.c (pthread_create): Cleanup my_attr resource by calling pthread_attr_destroy (only if GC_ASSERTIONS). --- pthread_support.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pthread_support.c b/pthread_support.c index 24e8288e..a2546e23 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -1658,8 +1658,10 @@ GC_API int WRAP_FUNC(pthread_create)(pthread_t *new_thread, } if (0 == stack_size) { pthread_attr_t my_attr; + pthread_attr_init(&my_attr); pthread_attr_getstacksize(&my_attr, &stack_size); + pthread_attr_destroy(&my_attr); } /* On Solaris 10, with default attr initialization, */ /* stack_size remains 0. Fudge it. */ -- 2.40.0