summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2015-07-31 17:07:30 -0400
committerAdam <Adam@anope.org>2015-07-31 17:07:30 -0400
commite65a22ae9d15264453ea75db5d8246569b0d79d3 (patch)
tree2b852017b2ca553e63e5384bb52b5de8fe06ccee
parent4e8cc4f786cd13cc3df2e9efea46e822fc03bd88 (diff)
Fix use after free from unloading modules which are the last one holding onto an IdentifyRequest
-rw-r--r--src/account.cpp14
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;
+ }
}
}