summaryrefslogtreecommitdiffstats
path: root/lib/libkse/thread/thr_attr_destroy.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libkse/thread/thr_attr_destroy.c')
-rw-r--r--lib/libkse/thread/thr_attr_destroy.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/libkse/thread/thr_attr_destroy.c b/lib/libkse/thread/thr_attr_destroy.c
index be6b2a2..1f4b2c8 100644
--- a/lib/libkse/thread/thr_attr_destroy.c
+++ b/lib/libkse/thread/thr_attr_destroy.c
@@ -39,11 +39,19 @@
int pthread_attr_destroy(pthread_attr_t *attr)
{
int ret;
- if (attr == NULL || *attr == NULL) {
- errno = EINVAL;
- ret = -1;
- } else {
+
+ /* Check for invalid arguments: */
+ if (attr == NULL || *attr == NULL)
+ /* Invalid argument: */
+ ret = EINVAL;
+ else {
+ /* Free the memory allocated to the attribute object: */
free(*attr);
+
+ /*
+ * Leave the attribute pointer NULL now that the memory
+ * has been freed:
+ */
*attr = NULL;
ret = 0;
}
OpenPOWER on IntegriCloud