mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-09 19:32:11 +00:00
SAGA2: Fix double free
This commit is contained in:
parent
ccc350d400
commit
1cc521808f
@ -1817,8 +1817,7 @@ bool GameObject::addTimer(TimerID id, int16 frameInterval) {
|
||||
assert((*it)->getObject() == this);
|
||||
|
||||
if (newTimer->thisID() == (*it)->thisID()) {
|
||||
timerList->_timers.remove(*it);
|
||||
delete *it;
|
||||
timerList->_timers.erase(it);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -1840,7 +1839,7 @@ void GameObject::removeTimer(TimerID id) {
|
||||
if ((timerList = fetchTimerList(this)) != nullptr) {
|
||||
for (Common::List<Timer *>::iterator it = timerList->_timers.begin(); it != timerList->_timers.end(); ++it) {
|
||||
if ((*it)->thisID() == id) {
|
||||
timerList->_timers.remove(*it);
|
||||
timerList->_timers.erase(it);
|
||||
|
||||
if (timerList->_timers.empty())
|
||||
delete timerList;
|
||||
|
Loading…
Reference in New Issue
Block a user