From 515b336801b3ad1838723e2084683f09eeccfb23 Mon Sep 17 00:00:00 2001 From: "chunxu.li" Date: Mon, 27 Apr 2020 21:27:42 +0800 Subject: [PATCH] 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 Signed-off-by: Jaroslav Kysela --- src/pcm/pcm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index eb8f686d..06a48f4c 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -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 */ -- 2.11.0