From a751f85096c07e7cf315900ceaec58092e9dd369 Mon Sep 17 00:00:00 2001 From: Wesley Shillingford Date: Tue, 22 Oct 2019 22:55:42 +0100 Subject: [PATCH] ASAN leak when exiting node (#2360) --- nano/lib/utility.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nano/lib/utility.cpp b/nano/lib/utility.cpp index a5d1135b..ede99219 100644 --- a/nano/lib/utility.cpp +++ b/nano/lib/utility.cpp @@ -281,7 +281,10 @@ void nano::worker::push_task (std::function func_a) { { nano::lock_guard guard (mutex); - queue.emplace_back (func_a); + if (!stopped) + { + queue.emplace_back (func_a); + } } cv.notify_one (); @@ -292,6 +295,7 @@ void nano::worker::stop () { nano::unique_lock lk (mutex); stopped = true; + queue.clear (); } cv.notify_one (); if (thread.joinable ())