Fix memory leak visible apollo driver (nw)

This commit is contained in:
Miodrag Milanovic 2014-04-02 07:45:17 +00:00
parent 996e96fa4a
commit fac598ebd1
2 changed files with 10 additions and 1 deletions

View File

@ -473,7 +473,7 @@ void threecom3c505_device::data_buffer_fifo::start(
m_size = RX_FIFO_SIZE; // size;
for (i = 0; i < m_size; i++)
{
m_db[i] = new data_buffer();
m_db[i] = global_alloc(data_buffer());
m_db[i]->start(device, db_size);
}
}
@ -485,6 +485,14 @@ void threecom3c505_device::data_buffer_fifo::reset()
m_count = 0;
}
threecom3c505_device::data_buffer_fifo::~data_buffer_fifo()
{
for (int i = 0; i < m_size; i++)
{
global_free(m_db[i]);
}
}
int threecom3c505_device::data_buffer_fifo::put(const UINT8 data[], const int length)
{
UINT16 next_index = (m_put_index + 1) % m_size;

View File

@ -175,6 +175,7 @@ private:
{
public:
data_buffer_fifo();
~data_buffer_fifo();
void start(threecom3c505_device *device, INT32 size, INT32 db_size);
void reset();
int put(const UINT8 data[], const int length);