From 71240d19be193ba0be21168c7b68df3843f525ad Mon Sep 17 00:00:00 2001 From: rlar Date: Fri, 21 Sep 2012 21:16:23 +0200 Subject: [PATCH] free spice_init_devices() allocated memory in com_quit() --- src/frontend/misccoms.c | 2 ++ src/main.c | 4 ++++ src/spicelib/devices/dev.c | 12 ++++++++++++ src/spicelib/devices/dev.h | 1 + 4 files changed, 19 insertions(+) diff --git a/src/frontend/misccoms.c b/src/frontend/misccoms.c index e0e412a65..4fb45fc14 100644 --- a/src/frontend/misccoms.c +++ b/src/frontend/misccoms.c @@ -29,6 +29,7 @@ extern char history_file[]; #endif extern IFsimulator SIMinfo; +extern void spice_destroy_devices(void); /* FIXME need a better place */ static void byemesg(void); static int confirm_quit(void); @@ -80,6 +81,7 @@ com_quit(wordlist *wl) byemesg(); destroy_const_plot(); + spice_destroy_devices(); exit(exitcode); } diff --git a/src/main.c b/src/main.c index 78c5b3796..66e209e39 100644 --- a/src/main.c +++ b/src/main.c @@ -374,6 +374,10 @@ void SMPprintRHS( SMPmatrix *n1, char *n2 , double* n3 , double* n4) return; } +void spice_destroy_devices(void) +{ +} + #endif /* SIMULATOR */ #ifndef SIMULATOR diff --git a/src/spicelib/devices/dev.c b/src/spicelib/devices/dev.c index cae2ec25d..8e16310f4 100644 --- a/src/spicelib/devices/dev.c +++ b/src/spicelib/devices/dev.c @@ -233,6 +233,18 @@ int load_vadev(CKTcircuit *ckt, char *name) } #endif + +void +spice_destroy_devices(void) +{ +#ifdef XSPICE + tfree(g_evt_udn_info); + tfree(DEVicesfl); +#endif + tfree(DEVices); +} + + void spice_init_devices(void) { diff --git a/src/spicelib/devices/dev.h b/src/spicelib/devices/dev.h index be6a07b03..c366aee67 100644 --- a/src/spicelib/devices/dev.h +++ b/src/spicelib/devices/dev.h @@ -3,6 +3,7 @@ void spice_init_devices(void); +void spice_destroy_devices(void); int num_devices(void); IFdevice **devices_ptr(void); SPICEdev **devices(void);