aboutsummaryrefslogtreecommitdiff
path: root/sim/tic80/sim-calls.c
diff options
context:
space:
mode:
Diffstat (limited to 'sim/tic80/sim-calls.c')
-rw-r--r--sim/tic80/sim-calls.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sim/tic80/sim-calls.c b/sim/tic80/sim-calls.c
index 6c8098c..b85480e 100644
--- a/sim/tic80/sim-calls.c
+++ b/sim/tic80/sim-calls.c
@@ -68,7 +68,20 @@ sim_open (SIM_OPEN_KIND kind, char **argv)
FIXME: Hmmm... in the case of gdb we need getopt to call
print_filtered. */
if (sim_parse_args (&simulation, argv) != SIM_RC_OK)
- return 0;
+ {
+ /* Uninstall the modules to avoid memory leaks,
+ file descriptor leaks, etc. */
+ sim_module_uninstall (&simulation);
+ return 0;
+ }
+
+ if (sim_post_argv_init (&simulation) != SIM_RC_OK)
+ {
+ /* Uninstall the modules to avoid memory leaks,
+ file descriptor leaks, etc. */
+ sim_module_uninstall (&simulation);
+ return 0;
+ }
engine_init(&simulation);
@@ -95,6 +108,9 @@ sim_size (int i)
void
sim_close (SIM_DESC sd, int quitting)
{
+ /* Uninstall the modules to avoid memory leaks,
+ file descriptor leaks, etc. */
+ sim_module_uninstall (&simulation);
}