When a thread attributes object is no longer required, it should be destroyed using the
pthread_attr_destroy() function. Destroying a thread attributes object has no effect on threads that were created using that object.
Fixes: #12570
Signed-off-by: zqkqkz zheng.qiankun@h3c.com
(cherry picked from commit
9471bb838a420ef5f439191d87e5388fecccb9e6)
r = pthread_create(&thread_id, thread_attr, _entry_func, (void*)this);
restore_sigset(&old_sigset);
+ if (thread_attr) {
+ pthread_attr_destroy(thread_attr);
+ }
+
return r;
}