Commit a9c33d15 authored by David Reid's avatar David Reid

Fix a crash when initializing a POSIX thread.

Public issue https://github.com/mackron/miniaudio/issues/247
parent c07411dd
...@@ -10003,8 +10003,6 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority ...@@ -10003,8 +10003,6 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
} }
} }
} }
pthread_attr_destroy(&attr);
} }
#else #else
/* It's the emscripten build. We'll have a few unused parameters. */ /* It's the emscripten build. We'll have a few unused parameters. */
...@@ -10013,6 +10011,12 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority ...@@ -10013,6 +10011,12 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
#endif #endif
result = pthread_create(pThread, pAttr, entryProc, pData); result = pthread_create(pThread, pAttr, entryProc, pData);
/* The thread attributes object is no longer required. */
if (pAttr != NULL) {
pthread_attr_destroy(pAttr);
}
if (result != 0) { if (result != 0) {
return ma_result_from_errno(result); return ma_result_from_errno(result);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment