(mess) psxcd: free incomplete result pointers on exit or reset (nw)

This commit is contained in:
cracyc 2013-05-21 22:13:48 +00:00
parent 8e9303fc33
commit 2d474c6a3b
2 changed files with 18 additions and 0 deletions

View File

@ -145,6 +145,21 @@ void psxcd_device::device_start()
save_item(NAME(m_param_count));
}
void psxcd_device::device_stop()
{
for (int i = 0; i < MAX_PSXCD_TIMERS; i++)
{
if(m_timerinuse[i] && m_timers[i]->ptr())
global_free(m_timers[i]->ptr());
}
while(res_queue)
{
command_result *res = res_queue->next;
global_free(res_queue);
res_queue = res;
}
}
void psxcd_device::device_reset()
{
next_read_event = -1;
@ -152,6 +167,8 @@ void psxcd_device::device_reset()
for (int i = 0; i < MAX_PSXCD_TIMERS; i++)
{
if(m_timerinuse[i] && m_timers[i]->ptr())
global_free(m_timers[i]->ptr());
m_timers[i]->adjust(attotime::never, 0, attotime::never);
m_timerinuse[i] = false;
}

View File

@ -33,6 +33,7 @@ public:
protected:
virtual void device_start();
virtual void device_stop();
virtual void device_reset();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);