From 1c408f6086a08a9a2bb3aa23bd3ff6e120dea886 Mon Sep 17 00:00:00 2001 From: PobreGato <315121269+pobregat0@users.noreply.github.com> Date: Fri, 18 Sep 2026 19:57:20 -0400 Subject: [PATCH] detach memory pool list before freeing it --- libi2pd/util.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libi2pd/util.h b/libi2pd/util.h index 44b054a2..cb30ba90 100644 --- a/libi2pd/util.h +++ b/libi2pd/util.h @@ -60,8 +60,12 @@ namespace util void CleanUp () { - CleanUp (m_Head); + // detach the list first: while it is being freed m_Head would point + // to already deleted memory, and Acquire or Release from another + // thread reads or writes it + auto head = m_Head; m_Head = nullptr; + CleanUp (head); } template