From 4fb75fbd51dc8599030531afc9de9e084abbaecb Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 7 Apr 2012 19:06:45 +0200 Subject: [PATCH] INPgetTree(), express the live range of some globals --- src/spicelib/parser/inpptree.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/spicelib/parser/inpptree.c b/src/spicelib/parser/inpptree.c index af3aaa15d..f257210cd 100644 --- a/src/spicelib/parser/inpptree.c +++ b/src/spicelib/parser/inpptree.c @@ -141,24 +141,32 @@ INPgetTree(char **line, INPparseTree ** pt, CKTcircuit *ckt, INPtables * tab) rv = PTparse(line, &p, ckt); if (rv || !PTcheck(p)) { + *pt = NULL; - return; - } - (*pt) = TMALLOC(INPparseTree, 1); + } else { + + (*pt) = TMALLOC(INPparseTree, 1); - (*pt)->p.numVars = numvalues; - (*pt)->p.varTypes = types; - (*pt)->p.vars = values; - (*pt)->p.IFeval = IFeval; - (*pt)->tree = p; + (*pt)->p.numVars = numvalues; + (*pt)->p.varTypes = types; + (*pt)->p.vars = values; + (*pt)->p.IFeval = IFeval; + (*pt)->tree = p; - (*pt)->derivs = TMALLOC(INPparseNode *, numvalues); + (*pt)->derivs = TMALLOC(INPparseNode *, numvalues); - for (i = 0; i < numvalues; i++) - (*pt)->derivs[i] = PTdifferentiate(p, i); + for (i = 0; i < numvalues; i++) + (*pt)->derivs[i] = PTdifferentiate(p, i); - return; + } + + values = NULL; + types = NULL; + numvalues = 0; + + circuit = NULL; + tables = NULL; } /* This routine takes the partial derivative of the parse tree with respect to