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

Null out the actor's ROI pointer before deletion to prevent its
destructor from dereferencing the already-freed ROI.
This commit is contained in:
foxtacles 2026-04-05 13:26:37 -07:00 committed by GitHub
parent b3e73aa675
commit e05a741840
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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