Fix use-after-free in LegoCharacterManager::ReleaseActor (#214)

Null out the actor's ROI pointer before deletion to prevent its
destructor from dereferencing the already-freed ROI.
This commit is contained in:
Christian Semmler 2026-04-05 13:09:04 -07:00
parent b3e73aa675
commit bb5daa17d2

View File

@ -358,6 +358,7 @@ void LegoCharacterManager::ReleaseActor(const char* p_name)
if (info != NULL) {
if (info->m_actor != NULL) {
info->m_actor->SetROI(NULL, FALSE, FALSE);
info->m_actor->ClearFlag(LegoEntity::c_managerOwned);
delete info->m_actor;
}
@ -400,6 +401,7 @@ void LegoCharacterManager::ReleaseActor(LegoROI* p_roi)
if (info != NULL) {
if (info->m_actor != NULL) {
info->m_actor->SetROI(NULL, FALSE, FALSE);
info->m_actor->ClearFlag(LegoEntity::c_managerOwned);
delete info->m_actor;
}