misccoms.c, enable freeing more memory allocations upon 'quit'

reduces valgrind 'still reachable' allocations
will finally allow using 'virtual leak detector' on Windows
This commit is contained in:
h_vogt 2016-07-24 19:16:02 +02:00 committed by rlar
parent 0df6750947
commit 35fabfc845
1 changed files with 8 additions and 10 deletions

View File

@ -63,12 +63,10 @@ com_quit(wordlist *wl)
/* start to clean up the mess */ /* start to clean up the mess */
#ifdef SHARED_MODULE
{ {
wordlist all = { "all", NULL, NULL }; wordlist all = { "all", NULL, NULL };
wordlist star = { "*", NULL, NULL }; wordlist star = { "*", NULL, NULL };
// com_remcirc(NULL);
com_destroy(&all); com_destroy(&all);
com_unalias(&star); com_unalias(&star);
com_undefine(&star); com_undefine(&star);
@ -80,7 +78,6 @@ com_quit(wordlist *wl)
cp_remvar("program"); cp_remvar("program");
cp_remvar("prompt"); cp_remvar("prompt");
} }
#endif
#ifdef EXPERIMENTAL_CODE #ifdef EXPERIMENTAL_CODE
/* Destroy CKT when quit. Add by Gong Ding, gdiso@ustc.edu */ /* Destroy CKT when quit. Add by Gong Ding, gdiso@ustc.edu */
@ -92,32 +89,33 @@ com_quit(wordlist *wl)
} }
#endif #endif
#ifdef SHARED_MODULE
/* Destroy CKT when quit. */ /* Destroy CKT when quit. */
if (!ft_nutmeg) { if (!ft_nutmeg) {
while(ft_curckt) while(ft_curckt)
com_remcirc(NULL); com_remcirc(NULL);
} }
#endif
DevSwitch(NULL); DevSwitch(NULL);
DevSwitch(NULL); DevSwitch(NULL);
/* then go away */
#ifdef SHARED_MODULE
cp_destroy_keywords(); cp_destroy_keywords();
destroy_ivars(); destroy_ivars();
#endif
byemesg(); byemesg();
#ifdef SHARED_MODULE
destroy_const_plot(); destroy_const_plot();
spice_destroy_devices(); spice_destroy_devices();
#ifdef SHARED_MODULE
sh_delete_myvec(); sh_delete_myvec();
sh_delvecs(); sh_delvecs();
#endif #endif
mc_free(); mc_free();
cp_remvar_all();
if (Infile_Path)
tfree(Infile_Path);
#ifdef SHARED_MODULE #ifdef SHARED_MODULE
/* add 1000 to notify that we exit from 'quit' */ /* add 1000 to notify that we exit from 'quit' */
controlled_exit(1000 + exitcode); controlled_exit(1000 + exitcode);