From ffee2a6b5ff6a5c7e0b41d83677618e5e5a4c7cc Mon Sep 17 00:00:00 2001 From: h_vogt Date: Tue, 29 Mar 2016 20:20:22 +0200 Subject: [PATCH] parser/inppas3.c, fix memory ownership `INPgetTok()' creates `nodename' which is then committed to `INPtermInsert()' --- src/spicelib/parser/inppas3.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/spicelib/parser/inppas3.c b/src/spicelib/parser/inppas3.c index 23778ad2c..d81a0fe09 100644 --- a/src/spicelib/parser/inppas3.c +++ b/src/spicelib/parser/inppas3.c @@ -84,10 +84,11 @@ INPpas3(CKTcircuit *ckt, card *data, INPtables *tab, TSKtask *task, /* check to see if in the form V(xxx) and grab the xxx */ if( (*name == 'V' || *name == 'v') && !name[1] ) { /* looks like V - must be V(xx) - get xx now*/ - INPgetTok(&line,&name,1); - if (INPtermInsert(ckt,&name,tab,&node1)!=E_EXISTS) + char *nodename; + INPgetTok(&line,&nodename,1); + if (INPtermInsert(ckt,&nodename,tab,&node1)!=E_EXISTS) fprintf(stderr, - "Warning : Nodeset on non-existant node - %s\n", name); + "Warning : Nodeset on non-existant node - %s\n", nodename); ptemp.rValue = INPevaluate(&line,&error,1); IFC(setNodeParm, (ckt, node1, which, &ptemp, NULL)); continue; @@ -122,10 +123,11 @@ INPpas3(CKTcircuit *ckt, card *data, INPtables *tab, TSKtask *task, } if( (*name == 'V' || *name == 'v') && !name[1] ) { /* looks like V - must be V(xx) - get xx now*/ - INPgetTok(&line,&name,1); - if (INPtermInsert(ckt,&name,tab,&node1)!=E_EXISTS) + char *nodename; + INPgetTok(&line,&nodename,1); + if (INPtermInsert(ckt,&nodename,tab,&node1)!=E_EXISTS) fprintf(stderr, - "Warning : IC on non-existant node - %s\n", name); + "Warning : IC on non-existant node - %s\n", nodename); ptemp.rValue = INPevaluate(&line,&error,1); IFC(setNodeParm, (ckt, node1, which, &ptemp, NULL)); continue;