about summary refs log tree commit diff
path: root/nptl/pthread_attr_destroy.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-06-02 10:33:30 +0200
committerFlorian Weimer <fweimer@redhat.com>2020-06-02 11:54:58 +0200
commit7538d461134bf306e31b40e4032f0c225bb40d51 (patch)
tree34c4ceb7c6565864dfc62d8e23dd8f37e24944af /nptl/pthread_attr_destroy.c
parent6993670b52daa413717e840dfb17b5322e7f4a88 (diff)
downloadglibc-7538d461134bf306e31b40e4032f0c225bb40d51.tar.gz
glibc-7538d461134bf306e31b40e4032f0c225bb40d51.tar.xz
glibc-7538d461134bf306e31b40e4032f0c225bb40d51.zip
nptl: Make pthread_attr_t dynamically extensible
This introduces the function __pthread_attr_extension to allocate the
extension space, which is freed by pthread_attr_destroy.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'nptl/pthread_attr_destroy.c')
-rw-r--r--nptl/pthread_attr_destroy.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/nptl/pthread_attr_destroy.c b/nptl/pthread_attr_destroy.c
index 21f8026a2c..b6a3cca657 100644
--- a/nptl/pthread_attr_destroy.c
+++ b/nptl/pthread_attr_destroy.c
@@ -30,12 +30,16 @@ __pthread_attr_destroy (pthread_attr_t *attr)
   iattr = (struct pthread_attr *) attr;
 
 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_1)
-  /* In old struct pthread_attr, neither next nor cpuset are
-     present.  */
+  /* In old struct pthread_attr, the extension member is missing.  */
   if (__builtin_expect ((iattr->flags & ATTR_FLAG_OLDATTR), 0) == 0)
 #endif
-    /* The affinity CPU set might be allocated dynamically.  */
-    free (iattr->cpuset);
+    {
+      if (iattr->extension != NULL)
+        {
+          free (iattr->extension->cpuset);
+          free (iattr->extension);
+        }
+    }
 
   return 0;
 }