diff options
author | Adam <Adam@anope.org> | 2015-07-31 17:07:30 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2015-07-31 17:07:30 -0400 |
commit | e65a22ae9d15264453ea75db5d8246569b0d79d3 (patch) | |
tree | 2b852017b2ca553e63e5384bb52b5de8fe06ccee | |
parent | 4e8cc4f786cd13cc3df2e9efea46e822fc03bd88 (diff) |
Fix use after free from unloading modules which are the last one holding onto an IdentifyRequest
-rw-r--r-- | src/account.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/account.cpp b/src/account.cpp index e58ee1646..89c9c7909 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -73,8 +73,20 @@ void IdentifyRequest::ModuleUnload(Module *m) IdentifyRequest *ir = *it; ++it; - ir->Release(m); + ir->holds.erase(m); + if (ir->holds.empty() && ir->dispatched) + { + if (!ir->success) + ir->OnFail(); + delete ir; + continue; + } + if (ir->owner == m) + { + if (!ir->success) + ir->OnFail(); delete ir; + } } } |