mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 09:12:44 +00:00
libstdthreads: destroy mutexattr in mtx_init()
PR: 276818
(cherry picked from commit a03f768612
)
This commit is contained in:
parent
2e009b460f
commit
58ccdcc6ff
@ -43,7 +43,7 @@ int
|
||||
mtx_init(mtx_t *mtx, int type)
|
||||
{
|
||||
pthread_mutexattr_t attr;
|
||||
int mt;
|
||||
int mt, res;
|
||||
|
||||
switch (type) {
|
||||
case mtx_plain:
|
||||
@ -60,11 +60,12 @@ mtx_init(mtx_t *mtx, int type)
|
||||
|
||||
if (pthread_mutexattr_init(&attr) != 0)
|
||||
return (thrd_error);
|
||||
if (pthread_mutexattr_settype(&attr, mt) != 0)
|
||||
return (thrd_error);
|
||||
if (pthread_mutex_init(mtx, &attr) != 0)
|
||||
return (thrd_error);
|
||||
return (thrd_success);
|
||||
res = thrd_success;
|
||||
if (pthread_mutexattr_settype(&attr, mt) != 0 ||
|
||||
pthread_mutex_init(mtx, &attr) != 0)
|
||||
res = thrd_error;
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
return (res);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user