mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-10 13:30:01 -05:00
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:
parent
6fad36dd38
commit
515b336801
1 changed files with 1 additions and 0 deletions
|
|
@ -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);
|
||||
#endif
|
||||
pthread_mutex_init(&pcm->lock, &attr);
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
/* use locking as default;
|
||||
* each plugin may suppress this in its open call
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue