mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-10-06 12:08:52 +00:00
Merge pull request #2565 from pobregat0/pool-cleanup-order
detach memory pool list before freeing it
This commit is contained in:
+5
-1
@@ -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<typename... TArgs>
|
||||
|
||||
Reference in New Issue
Block a user