parser/inppas3.c, fix memory ownership

`INPgetTok()' creates `nodename' which is then committed to `INPtermInsert()'
This commit is contained in:
h_vogt 2016-03-29 20:20:22 +02:00 committed by rlar
parent ddf01dbe3f
commit ffee2a6b5f
1 changed files with 8 additions and 6 deletions

View File

@ -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;