diff --git a/src/frontend/com_hardcopy.c b/src/frontend/com_hardcopy.c index 3de71d8a1..9423f55ee 100644 --- a/src/frontend/com_hardcopy.c +++ b/src/frontend/com_hardcopy.c @@ -265,8 +265,11 @@ void com_hardcopy(wordlist *wl) } } - if (tempf && *device) + if (tempf && *device) { (void) unlink(fname); + } + + tfree(fname); /* restore previous graphics context by retrieving the previous currentgraph */ PopGraphContext(); diff --git a/src/frontend/svg.c b/src/frontend/svg.c index 35abf0df4..5f01481f5 100644 --- a/src/frontend/svg.c +++ b/src/frontend/svg.c @@ -181,16 +181,20 @@ SVG_Init(void) Cfg.ints[SVG_GRID_WIDTH] = 0; if (cp_getvar("hcopyfont", CP_STRING, &strbuf, sizeof(strbuf))) { + tfree(Cfg.strings[SVG_FONT]); Cfg.strings[SVG_FONT] = strdup(strbuf); } else if (!stropts_isset) { + tfree(Cfg.strings[SVG_FONT]); Cfg.strings[SVG_FONT] = strdup("Helvetica"); } if (cp_getvar("hcopyfontfamily", CP_STRING, &strbuf, sizeof(strbuf))) { + tfree(Cfg.strings[SVG_FONT_FAMILY]); Cfg.strings[SVG_FONT_FAMILY] = strdup(strbuf); } else if (!stropts_isset){ + tfree(Cfg.strings[SVG_FONT_FAMILY]); Cfg.strings[SVG_FONT_FAMILY] = strdup("Helvetica"); } @@ -203,8 +207,10 @@ SVG_Init(void) sprintf(colorN, "color%d", colorid); if (cp_getvar(colorN, CP_STRING, colorstring, sizeof(colorstring))) { colors[colorid] = strdup(colorstring); - if (colorid == 0) + if (colorid == 0) { + tfree(Cfg.strings[SVG_BACKGROUND]); Cfg.strings[SVG_BACKGROUND] = strdup(colors[0]); + } } else { colors[colorid] = strdup(svgcolors[colorid]); @@ -302,6 +308,8 @@ SVG_NewViewport(GRAPH *graph) /* Allocate and initialise per-graph data. */ + tfree(graph->devdep); + graph->devdep = TMALLOC(SVGdevdep, 1); ddp = DEVDEP_P(graph); ddp->lastx = ddp->lasty = -1;