From 6d47351d15e8542a55450d887381fb33da9d8ef6 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 28 Feb 2021 21:40:50 -0500 Subject: [PATCH] Fix heap-use-after-free issue with groups ==2317==ERROR: AddressSanitizer: heap-use-after-free on address 0x6170000633c0 at pc 0x55ed1d8e8d8b bp 0x7ffda4bef580 sp 0x7ffda4bef578 WRITE of size 8 at 0x6170000633c0 thread T0 #0 0x55ed1d8e8d8a in Group::SetLeader(Mob*) ../zone/groups.h:80 #1 0x55ed1d8e8d8a in Group::DisbandGroup(bool) ../zone/groups.cpp:1016 ASan didn't like this --- zone/groups.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index 4b8e25d09..13188dcb9 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1006,8 +1006,6 @@ void Group::DisbandGroup(bool joinraid) { database.ClearGroup(GetID()); } - entity_list.RemoveGroup(GetID()); - if(Leader && (Leader->IsLFP())) { Leader->UpdateLFP(); @@ -1015,6 +1013,7 @@ void Group::DisbandGroup(bool joinraid) { SetLeader(nullptr); safe_delete(outapp); + entity_list.RemoveGroup(GetID()); } void Group::GetMemberList(std::list& member_list, bool clear_list)