diff --git a/src/frontend/postcoms.c b/src/frontend/postcoms.c index 138d69dec..8f9f40193 100644 --- a/src/frontend/postcoms.c +++ b/src/frontend/postcoms.c @@ -867,19 +867,20 @@ killplot(struct plot *pl) tfree(pl->pl_name); tfree(pl->pl_typename); wl_free(pl->pl_commands); - tfree(pl->pl_date); /* va: also tfree (memory leak) */ - if (pl->pl_ccom) /* va: also tfree (memory leak) */ + tfree(pl->pl_date); + if (pl->pl_ccom) throwaway(pl->pl_ccom); - if (pl->pl_env) { /* The 'environment' for this plot. */ - /* va: HOW to do? */ - printf("va: killplot should tfree pl->pl_env=(%p)\n", pl->pl_env); - fflush(stdout); - } - tfree(pl); /* va: also tfree pl itself (memory leak) */ + if (pl->pl_env) + free_struct_variable(pl->pl_env); + if (pl->pl_lookup_table) + nghash_free(pl->pl_lookup_table, NULL, NULL); + tfree(pl); } +/* shared ngspice: remove plot 'const' upon 'quit' + constanplot is not dynamically allocated on the heap */ void destroy_const_plot(void) { @@ -892,14 +893,13 @@ destroy_const_plot(void) vec_free(v); } wl_free(pl->pl_commands); - if (pl->pl_ccom) /* va: also tfree (memory leak) */ + if (pl->pl_ccom) throwaway(pl->pl_ccom); - if (pl->pl_env) { /* The 'environment' for this plot. */ - /* va: HOW to do? */ - printf("va: killplot should tfree pl->pl_env=(%p)\n", pl->pl_env); - fflush(stdout); - } + if (pl->pl_env) + free_struct_variable(pl->pl_env); + if (pl->pl_lookup_table) + nghash_free(pl->pl_lookup_table, NULL, NULL); }