event/SocketMonitor: don't cancel if OnSocketReady() returns false
Expect OnSocketReady() to cancel events. If it returns false, the SocketMonitor may be destructed already. This fixes a use-after-free bug in the "httpd" output plugin.
This commit is contained in:
@@ -33,8 +33,8 @@ SocketMonitor::Dispatch(unsigned flags) noexcept
|
||||
{
|
||||
flags &= GetScheduledFlags();
|
||||
|
||||
if (flags != 0 && !OnSocketReady(flags) && IsDefined())
|
||||
Cancel();
|
||||
if (flags != 0)
|
||||
OnSocketReady(flags);
|
||||
}
|
||||
|
||||
SocketMonitor::~SocketMonitor() noexcept
|
||||
|
Reference in New Issue
Block a user