From 2a9723e06dc328c0a7565ab5e95dd07f3f5198f2 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sat, 22 Dec 2012 20:20:00 +0100 Subject: [PATCH] inpdpar.c: remove memory leak --- src/spicelib/parser/inpdpar.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/spicelib/parser/inpdpar.c b/src/spicelib/parser/inpdpar.c index 13b6e5817..2add6fa42 100644 --- a/src/spicelib/parser/inpdpar.c +++ b/src/spicelib/parser/inpdpar.c @@ -55,6 +55,9 @@ char *INPdevParse(char **line, CKTcircuit *ckt, int dev, GENinstance *fast, } for (i = 0; i < *(ft_sim->devices[dev]->numInstanceParms); i++) { if (strcmp(parm, ft_sim->devices[dev]->instanceParms[i].keyword) == 0) { + + int type; + val = INPgetValue(ckt, line, ft_sim->devices[dev]->instanceParms[i].dataType, @@ -70,6 +73,15 @@ char *INPdevParse(char **line, CKTcircuit *ckt, int dev, GENinstance *fast, rtn = INPerror(error); goto quit; } + + /* delete the union val */ + type = ft_sim->devices[dev]->instanceParms[i].dataType; + type &= IF_VARTYPES; + if (type == IF_REALVEC) + tfree(val->v.vec.rVec); + else if (type == IF_INTVEC) + tfree(val->v.vec.iVec); + break; } }