Some more memory leak fixes.
- added method for logfunctions cleanup on app exit - delete default i/o handler names - delete pluginlog
This commit is contained in:
parent
d63e048ec6
commit
ae107f2cb8
@ -368,6 +368,8 @@ void bx_cleanup_siminterface()
|
||||
delete root_param;
|
||||
root_param = NULL;
|
||||
}
|
||||
io->exit_log2();
|
||||
delete io;
|
||||
}
|
||||
|
||||
bx_real_sim_c::bx_real_sim_c()
|
||||
|
@ -430,6 +430,9 @@ void bx_devices_c::exit()
|
||||
delete [] curr->handler_name;
|
||||
delete curr;
|
||||
}
|
||||
// delete default read handler name
|
||||
delete [] io_read_handlers.handler_name;
|
||||
io_read_handlers.handler_name = NULL;
|
||||
struct io_handler_struct *io_write_handler = io_write_handlers.next;
|
||||
while (io_write_handler != &io_write_handlers) {
|
||||
io_write_handler->prev->next = io_write_handler->next;
|
||||
@ -439,6 +442,10 @@ void bx_devices_c::exit()
|
||||
delete [] curr->handler_name;
|
||||
delete curr;
|
||||
}
|
||||
// delete default write handler name
|
||||
delete [] io_write_handlers.handler_name;
|
||||
io_write_handlers.handler_name = NULL;
|
||||
// delete IRQ handler names
|
||||
for (int i = 0; i < BX_MAX_IRQS; i++) {
|
||||
delete [] irq_handler_name[i];
|
||||
irq_handler_name[i] = NULL;
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2020 The Bochs Project
|
||||
// Copyright (C) 2001-2023 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -171,6 +171,7 @@ void iofunctions::init_log(int fd)
|
||||
init_log(tmpfd);
|
||||
};
|
||||
|
||||
// called at simulation exit
|
||||
void iofunctions::exit_log()
|
||||
{
|
||||
flush();
|
||||
@ -182,6 +183,13 @@ void iofunctions::exit_log()
|
||||
}
|
||||
}
|
||||
|
||||
// called at application exit
|
||||
void iofunctions::exit_log2()
|
||||
{
|
||||
delete log;
|
||||
delete genlog;
|
||||
}
|
||||
|
||||
// all other functions may use genlog safely.
|
||||
#define LOG_THIS genlog->
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2021 The Bochs Project
|
||||
// Copyright (C) 2001-2023 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -112,6 +112,7 @@ public:
|
||||
void init_log(int fd);
|
||||
void init_log(FILE *fs);
|
||||
void exit_log();
|
||||
void exit_log2();
|
||||
void set_log_prefix(const char *prefix);
|
||||
int get_n_logfns() const { return n_logfn; }
|
||||
logfunc_t *get_logfn(int index) { return logfn_list[index]; }
|
||||
|
@ -670,6 +670,7 @@ void plugin_cleanup(void)
|
||||
#else
|
||||
plugin_cleanup_np();
|
||||
#endif
|
||||
delete pluginlog;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user