destroy `const' plot in com_quit()

This commit is contained in:
rlar 2012-09-21 21:15:41 +02:00
parent 7a5eeb2d9c
commit 811bf5664a
3 changed files with 27 additions and 0 deletions

View File

@ -79,6 +79,7 @@ com_quit(wordlist *wl)
destroy_ivars();
byemesg();
destroy_const_plot();
exit(exitcode);
}

View File

@ -22,6 +22,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "quote.h"
#include "variable.h"
#include "parser/complete.h" /* va: throwaway */
#include "plotting/plotting.h"
static void killplot(struct plot *pl);
@ -856,6 +857,29 @@ killplot(struct plot *pl)
}
void
destroy_const_plot(void)
{
struct dvec *v, *nv = NULL;
struct plot *pl = &constantplot;
/* pl_dvecs, pl_scale */
for (v = pl->pl_dvecs; v; v = nv) {
nv = v->v_next;
vec_free(v);
}
wl_free(pl->pl_commands);
if (pl->pl_ccom) /* va: also tfree (memory leak) */
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);
}
}
/* delete all windows with graphs dedrived from a given plot */
static void
DelPlotWindows(struct plot *pl)

View File

@ -16,5 +16,7 @@ void com_cross(wordlist *wl);
void com_destroy(wordlist *wl);
void com_splot(wordlist *wl);
void destroy_const_plot(void);
#endif