about summary refs log tree commit diff
path: root/nptl/pthread_attr_destroy.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/pthread_attr_destroy.c')
-rw-r--r--nptl/pthread_attr_destroy.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/nptl/pthread_attr_destroy.c b/nptl/pthread_attr_destroy.c
index fec04163b1..a04f5fe441 100644
--- a/nptl/pthread_attr_destroy.c
+++ b/nptl/pthread_attr_destroy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -28,16 +28,17 @@ int
 __pthread_attr_destroy (attr)
      pthread_attr_t *attr;
 {
+  struct pthread_attr *iattr;
+
+  assert (sizeof (*attr) >= sizeof (struct pthread_attr));
+  iattr = (struct pthread_attr *) attr;
+
   /* Enqueue the attributes to the list of all known variables.  */
   if (DEBUGGING_P)
     {
-      struct pthread_attr *iattr;
       struct pthread_attr *prevp = NULL;
       struct pthread_attr *runp;
 
-      assert (sizeof (*attr) >= sizeof (struct pthread_attr));
-      iattr = (struct pthread_attr *) attr;
-
       lll_lock (__attr_list_lock);
 
       runp = __attr_list;
@@ -62,6 +63,9 @@ __pthread_attr_destroy (attr)
 	return EINVAL;
     }
 
+  /* The affinity CPU set might be allocated dynamically.  */
+  free (iattr->cpuset);
+
   return 0;
 }
 strong_alias (__pthread_attr_destroy, pthread_attr_destroy)