diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c index 84ee7eed4..a696d4c69 100644 --- a/src/frontend/subckt.c +++ b/src/frontend/subckt.c @@ -999,6 +999,8 @@ translate(struct line *deck, char *formal, char *actual, char *scname, char *sub case '%': bxx_printf(&buffer, "%%"); /* don't translate the port type identifier */ + if (name) + tfree(name); name = next_name; next_name = MIFgettok(&s); bxx_printf(&buffer, "%s ", name); diff --git a/src/xspice/mif/mif_inp2.c b/src/xspice/mif/mif_inp2.c index 13cf419da..6aea4aadf 100644 --- a/src/xspice/mif/mif_inp2.c +++ b/src/xspice/mif/mif_inp2.c @@ -280,7 +280,9 @@ card *current ) /* the card we are to parse */ Otherwise use default info */ if(next_token_type == MIF_PERCENT_TOK) { /* we found a % */ /* get the port type identifier and check it for validity */ - next_token = MIFget_token(&line,&next_token_type); + if (next_token) + tfree(next_token); + next_token = MIFget_token(&line, &next_token_type); /* Note that MIFget_port_type eats the next token and advances the token pointer in line */ MIFget_port_type(ckt, tab, @@ -387,6 +389,8 @@ card *current ) /* the card we are to parse */ return; } else /* eat the [ */ + if (next_token) + tfree(next_token); next_token = MIFget_token(&line,&next_token_type); /*------ get and process ports until ] is encountered ------*/ @@ -446,7 +450,9 @@ card *current ) /* the card we are to parse */ We'll do that now, since when we enter the loop, we expect next_token to hold the next unprocessed token. */ - next_token = MIFget_token(&line,&next_token_type); + if (next_token) + tfree(next_token); + next_token = MIFget_token(&line, &next_token_type); } /* ====== array connection processing ====== */