Fix a crash when initializing a POSIX thread.

Public issue https://github.com/mackron/miniaudio/issues/247
This commit is contained in:
David Reid
2020-12-12 12:14:14 +10:00
parent c07411dde2
commit a9c33d152e
+6 -2
View File
@@ -10003,8 +10003,6 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
}
}
}
pthread_attr_destroy(&attr);
}
#else
/* 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
#endif
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) {
return ma_result_from_errno(result);
}