re-enable PostScript/SVG to file by pushbutton

on the ngspice plot window, avoid crash due to double freeing.
This commit is contained in:
Holger Vogt 2021-03-17 16:16:57 +01:00
parent e1ae8c7495
commit 9311674499
1 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@
* it doesn't. */ * it doesn't. */
void com_hardcopy(wordlist *wl) void com_hardcopy(wordlist *wl)
{ {
char *fname; char *fname = NULL;
size_t n_byte_fname; /* size of fname in bytes, including null */ size_t n_byte_fname; /* size of fname in bytes, including null */
char buf[BSIZE_SP], device[BSIZE_SP]; char buf[BSIZE_SP], device[BSIZE_SP];
bool tempf = FALSE; bool tempf = FALSE;
@ -117,7 +117,7 @@ void com_hardcopy(wordlist *wl)
n_byte_fname += 3; n_byte_fname += 3;
} }
} }
tempgraph->devdep = fname; tempgraph->devdep = copy(fname);
tempgraph->n_byte_devdep = n_byte_fname; tempgraph->n_byte_devdep = n_byte_fname;
if (NewViewport(tempgraph)) { if (NewViewport(tempgraph)) {
@ -150,7 +150,7 @@ void com_hardcopy(wordlist *wl)
return; return;
} }
tempgraph = CopyGraph(response.reply.graph); tempgraph = CopyGraph(response.reply.graph);
tempgraph->devdep = fname; tempgraph->devdep = copy(fname);
tempgraph->n_byte_devdep = n_byte_fname; tempgraph->n_byte_devdep = n_byte_fname;
if (NewViewport(tempgraph)) { if (NewViewport(tempgraph)) {
DevSwitch(NULL); DevSwitch(NULL);