Commit 57263961 authored by louiz’'s avatar louiz’
Browse files

Fix a use after free in IrcChannel::remove_user

parent c1f678e4
......@@ -37,11 +37,14 @@ IrcUser* IrcChannel::find_user(const std::string& name) const
void IrcChannel::remove_user(const IrcUser* user)
this->users.erase(std::remove_if(this->users.begin(), this->users.end(),
[user](const std::unique_ptr<IrcUser>& u)
return user->nick == u->nick;
}), this->users.end());
const auto nick = user->nick;
const auto it = std::find_if(this->users.begin(), this->users.end(),
[nick](const std::unique_ptr<IrcUser>& u)
return nick == u->nick;
if (it != this->users.end())
void IrcChannel::remove_all_users()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment