- fixed memory leaks found with valgrind when trying to start a second
simulation with wxBochs: * cpu: delete pageWriteStampTable array * devices: simplified setup of initial default i/o handlers * ne2k: delete ethernet module in destructor
This commit is contained in:
parent
72283f6760
commit
1f5d311ca1
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: icache.h,v 1.17 2006-05-19 20:04:33 sshwarts Exp $
|
||||
// $Id: icache.h,v 1.18 2006-09-20 20:52:23 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -55,6 +55,9 @@ public:
|
||||
|
||||
BX_CPP_INLINE void alloc(Bit32u memSize)
|
||||
{
|
||||
if (memSizeInBytes > 0) {
|
||||
delete [] pageWriteStampTable;
|
||||
}
|
||||
memSizeInBytes = memSize;
|
||||
pageWriteStampTable = new Bit32u [memSizeInBytes>>12];
|
||||
resetWriteStamps();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: devices.cc,v 1.110 2006-09-20 18:24:17 vruppert Exp $
|
||||
// $Id: devices.cc,v 1.111 2006-09-20 20:52:23 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -119,27 +119,19 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
unsigned i;
|
||||
const char def_name[] = "Default";
|
||||
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.110 2006-09-20 18:24:17 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.111 2006-09-20 20:52:23 vruppert Exp $"));
|
||||
mem = newmem;
|
||||
|
||||
/* set no-default handlers, will be overwritten by the real default handler */
|
||||
register_default_io_read_handler(NULL, &default_read_handler, def_name, 7);
|
||||
io_read_handlers.next = &io_read_handlers;
|
||||
io_read_handlers.prev = &io_read_handlers;
|
||||
io_read_handlers.handler_name = new char[strlen(def_name)+1];
|
||||
strcpy(io_read_handlers.handler_name, def_name);
|
||||
io_read_handlers.funct = (void *)&default_read_handler;
|
||||
io_read_handlers.this_ptr = NULL;
|
||||
io_read_handlers.usage_count = 0; // not used with the default handler
|
||||
io_read_handlers.mask = 7;
|
||||
|
||||
|
||||
register_default_io_write_handler(NULL, &default_write_handler, def_name, 7);
|
||||
io_write_handlers.next = &io_write_handlers;
|
||||
io_write_handlers.prev = &io_write_handlers;
|
||||
io_write_handlers.handler_name = new char[strlen(def_name)+1];
|
||||
strcpy(io_write_handlers.handler_name, def_name);
|
||||
io_write_handlers.funct = (void *)&default_write_handler;
|
||||
io_write_handlers.this_ptr = NULL;
|
||||
io_write_handlers.usage_count = 0; // not used with the default handler
|
||||
io_write_handlers.mask = 7;
|
||||
|
||||
if (read_port_to_handler)
|
||||
delete [] read_port_to_handler;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: ne2k.cc,v 1.89 2006-09-10 17:18:44 vruppert Exp $
|
||||
// $Id: ne2k.cc,v 1.90 2006-09-20 20:52:23 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -66,11 +66,15 @@ bx_ne2k_c::bx_ne2k_c()
|
||||
put("NE2K");
|
||||
settype(NE2KLOG);
|
||||
s.tx_timer_index = BX_NULL_TIMER_HANDLE;
|
||||
ethdev = NULL;
|
||||
}
|
||||
|
||||
|
||||
bx_ne2k_c::~bx_ne2k_c()
|
||||
{
|
||||
if (ethdev != NULL) {
|
||||
delete ethdev;
|
||||
}
|
||||
BX_DEBUG(("Exit"));
|
||||
}
|
||||
|
||||
@ -1404,7 +1408,7 @@ void bx_ne2k_c::init(void)
|
||||
char devname[16];
|
||||
bx_list_c *base;
|
||||
|
||||
BX_DEBUG(("Init $Id: ne2k.cc,v 1.89 2006-09-10 17:18:44 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: ne2k.cc,v 1.90 2006-09-20 20:52:23 vruppert Exp $"));
|
||||
|
||||
// Read in values from config interface
|
||||
base = (bx_list_c*) SIM->get_param(BXPN_NE2K);
|
||||
|
Loading…
Reference in New Issue
Block a user