Netlist: Fix a memory leak

This commit is contained in:
Couriersud 2013-12-03 19:19:00 +00:00
parent 0cf1dc1752
commit c9a4d6b0a8
2 changed files with 18 additions and 0 deletions

View File

@ -904,6 +904,21 @@ NETLIB_FUNC_VOID(nic9316_sub, update_outputs, (void))
#define ENTRY1(_nic, _name) m_list.add(new net_device_t_factory< _nic >( # _name, xstr(_nic) ));
#define ENTRY(_nic, _name) ENTRY1(NETLIB_NAME(_nic), _name)
netlist_factory::netlist_factory()
{
}
netlist_factory::~netlist_factory()
{
for (list_t::entry_t *e = m_list.first(); e != NULL; e = m_list.next(e))
{
net_device_t_base_factory *p = e->object();
delete p;
}
m_list.reset();
}
void netlist_factory::initialize()
{
ENTRY(R, NETDEV_R)

View File

@ -1143,6 +1143,9 @@ class netlist_factory
{
public:
netlist_factory();
~netlist_factory();
void initialize();
netlist_device_t *new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const;