From 3c3dc871af34dcfc93ada6fff125e46e8e70f044 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Wed, 12 Aug 2026 08:59:40 -0400 Subject: [PATCH] correct double free; --- src/fne/network/TrafficNetwork.MetricsLogging.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fne/network/TrafficNetwork.MetricsLogging.cpp b/src/fne/network/TrafficNetwork.MetricsLogging.cpp index 37c8a341..cf356e76 100644 --- a/src/fne/network/TrafficNetwork.MetricsLogging.cpp +++ b/src/fne/network/TrafficNetwork.MetricsLogging.cpp @@ -802,7 +802,6 @@ namespace { std::string threadName("fne:sqlite"); if (g_killed) { - delete th; return nullptr; } @@ -811,9 +810,12 @@ namespace { ::pthread_setname_np(th->thread, threadName.c_str()); #endif // _GNU_SOURCE - while (!g_killed) { + while (true) { size_t queueDepth = state->queue.pendingCount.load(std::memory_order_acquire); if (queueDepth == 0U) { + if (state->stopRequested.load(std::memory_order_acquire)) { + break; + } std::this_thread::sleep_for(std::chrono::milliseconds(SQLITE_BATCH_WAIT_MS)); continue; } @@ -880,7 +882,6 @@ namespace { } LogInfoEx(LOG_HOST, "[STOP] %s", threadName.c_str()); - delete th; return nullptr; }