From 7f36f122b2c25fac241946745e0764ac5847ce5b Mon Sep 17 00:00:00 2001 From: pasta Date: Sat, 23 Mar 2024 20:04:52 -0500 Subject: [PATCH] fix: fix potential mutex lifetime issue were we are returning a reference, and then releasing the mutex --- src/llmq/dkgsession.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/llmq/dkgsession.cpp b/src/llmq/dkgsession.cpp index b819a59347..bacfafa0ed 100644 --- a/src/llmq/dkgsession.cpp +++ b/src/llmq/dkgsession.cpp @@ -663,8 +663,9 @@ void CDKGSession::VerifyAndJustify(CDKGPendingMessages& pendingMessages) continue; } - const auto& qc = WITH_LOCK(invCs, return std::move(complaints.at(*m->complaints.begin()))); - if (qc.complainForMembers[*myIdx]) { + LOCK(invCs); + if (const auto& qc = complaints.at(*m->complaints.begin()); + qc.complainForMembers[*myIdx]) { justifyFor.emplace(qc.proTxHash); } }