From f708648ca5f89c62fef9aefccb0bf4d17e882518 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Fri, 8 Dec 2023 17:18:55 +0100 Subject: [PATCH] rem: fix coverity detected mutex lock in destructor (#1025) --- rem/aumix/aumix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rem/aumix/aumix.c b/rem/aumix/aumix.c index e034f3f2b..e7f0ced50 100644 --- a/rem/aumix/aumix.c +++ b/rem/aumix/aumix.c @@ -62,7 +62,11 @@ static void destructor(void *arg) { struct aumix *mix = arg; - if (mix->run) { + mtx_lock(&mix->mutex); + bool run = mix->run; + mtx_unlock(&mix->mutex); + + if (run) { mtx_lock(&mix->mutex); mix->run = false;