Remove sourceinfo upon shared ngspice reset.

Remove memory leaks.
This commit is contained in:
Holger Vogt 2024-07-20 17:54:43 +02:00
parent 272e4cc6fb
commit f0ff8b230b
2 changed files with 7 additions and 2 deletions

View File

@ -1288,7 +1288,7 @@ static struct inp_read_t inp_read(FILE* fp, int call_depth, const char* dir_name
add_to_sourcepath(sourcelineinfo, NULL);
}
wl_append_word(&sourceinfo, &sourceinfo, sourcelineinfo);
sourceinfo = wl_cons(sourcelineinfo, sourceinfo);
/* First read in all lines & put them in the struct cc */
for (;;) {

View File

@ -352,6 +352,8 @@ static char* outstorage(char*, bool);
static void printsend(void);
#endif
extern wordlist* sourceinfo;
static int totalreset(void);
extern void rem_controls(void);
extern void destroy_wallace(void);
@ -2464,6 +2466,10 @@ static int totalreset(void)
wordlist all = { "all", NULL, NULL };
wordlist star = { "*", NULL, NULL };
tfree(Infile_Path);
wl_free(sourceinfo);
sourceinfo = NULL;
com_destroy(&all);
com_unalias(&star);
com_undefine(&star);
@ -2480,7 +2486,6 @@ static int totalreset(void)
rem_controls();
while (ft_curckt) {
wl_delete(ft_curckt->ci_sourceinfo);
com_remcirc(NULL);
}