pcm: Fix memory leak at snd_pcm_new when THREAD_SAVE_API is defined

The pthread_mutexattr_t object should be destroyed by calling
pthread_mutexattr_destroy(), otherwise it may cause a potential
memory leak due to the different implement of pthread_mutexattr_init()

Signed-off-by: chunxu.li <chunxuxiao@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
chunxu.li 2020-04-27 21:27:42 +08:00 committed by Jaroslav Kysela
parent 6fad36dd38
commit 515b336801

View file

@ -2763,6 +2763,7 @@ int snd_pcm_new(snd_pcm_t **pcmp, snd_pcm_type_t type, const char *name,
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
#endif #endif
pthread_mutex_init(&pcm->lock, &attr); pthread_mutex_init(&pcm->lock, &attr);
pthread_mutexattr_destroy(&attr);
/* use locking as default; /* use locking as default;
* each plugin may suppress this in its open call * each plugin may suppress this in its open call
*/ */