summary refs log tree commit diff
path: root/nptl/pthread_setattr_default_np.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-05-19 11:03:11 +0200
committerFlorian Weimer <fweimer@redhat.com>2020-06-02 10:32:47 +0200
commit6993670b52daa413717e840dfb17b5322e7f4a88 (patch)
tree9e81fc9519354381a3d62c47f89cf9bb053e6f68 /nptl/pthread_setattr_default_np.c
parentc2322a561f74b8fa41b9d9c6b8eb57e28de46f3e (diff)
downloadglibc-6993670b52daa413717e840dfb17b5322e7f4a88.tar.gz
glibc-6993670b52daa413717e840dfb17b5322e7f4a88.tar.xz
glibc-6993670b52daa413717e840dfb17b5322e7f4a88.zip
nptl: Destroy the default thread attribute as part of freeres
This avoids a spurious memory leak report by valgrind.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'nptl/pthread_setattr_default_np.c')
-rw-r--r--nptl/pthread_setattr_default_np.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/nptl/pthread_setattr_default_np.c b/nptl/pthread_setattr_default_np.c
index c4cfb4e8ef..7a1c644334 100644
--- a/nptl/pthread_setattr_default_np.c
+++ b/nptl/pthread_setattr_default_np.c
@@ -81,3 +81,13 @@ pthread_setattr_default_np (const pthread_attr_t *in)
   lll_unlock (__default_pthread_attr_lock, LLL_PRIVATE);
   return ret;
 }
+
+/* This is placed in the same file as pthread_setattr_default_np
+   because only this function can trigger allocation of attribute
+   data.  This way, the function is automatically defined for all the
+   cases when it is needed in static builds.  */
+void
+__default_pthread_attr_freeres (void)
+{
+  __pthread_attr_destroy (&__default_pthread_attr.external);
+}