diff --git a/ChangeLog b/ChangeLog index c4c65437d..b6ba2b161 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * Fixed bug with define (see bug reference [ 999546 ] 'define' is broken in ngspice-15). + + * Fixed bug with 'plot title title_name' (see bug [ 557638 ] plot + segmentation fault). 2005-05-23 Steven Borley diff --git a/src/frontend/plotting/plotit.c b/src/frontend/plotting/plotit.c index 82c98ef8d..f23f46002 100644 --- a/src/frontend/plotting/plotit.c +++ b/src/frontend/plotting/plotit.c @@ -1,3 +1,4 @@ +/* $Id$ */ #include #include #include @@ -273,13 +274,18 @@ plotit(wordlist *wl, char *hcopy, char *devname) /* Now extract all the parameters. */ /* In case the parameter is the first on the line, we need a - * "buffer" word... + * "buffer" word. Use previous word up the chain if available, + * Otherwise create one. */ - tw = alloc(struct wordlist); - wl->wl_prev = tw; - tw->wl_next = wl; - wl = tw; - tw->wl_word = ""; + if(wl->wl_prev) { + wl = wl->wl_prev; + } else { + tw = alloc(struct wordlist); + wl->wl_prev = tw; + tw->wl_next = wl; + wl = tw; + tw->wl_word = ""; + } sameflag = getflag(wl, "samep"); @@ -518,7 +524,7 @@ plotit(wordlist *wl, char *hcopy, char *devname) nointerp = TRUE; wl = wl->wl_next; - tfree(tw); + if(tw) tfree(tw); if (!wl) { fprintf(cp_err, "Error: no vectors given\n"); goto quit1;