From d4af391ea1f1b1acc75725de59dbf4c4ba80e709 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sun, 17 Jul 2016 17:36:36 +0200 Subject: [PATCH] spiceif.c, remove memory leak ** to be tested thouroughly ** --- src/frontend/spiceif.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/frontend/spiceif.c b/src/frontend/spiceif.c index 9bdb96d99..b1ddbc3d7 100644 --- a/src/frontend/spiceif.c +++ b/src/frontend/spiceif.c @@ -732,8 +732,14 @@ spif_getparam_special(CKTcircuit *ckt, char **name, char *param, int ind, int do return (NULL); } pv = doask(ckt, typecode, dev, mod, opt, ind); - if (pv) + if (pv) { vv = parmtovar(pv, opt); + /* free only for VSRC and ISRC because they are definitely TMALLOCed, + when numValue as length of vector > 0. + All others will cause harm. */ + if (pv->v.vec.rVec && (pv->v.numValue > 0) && ((typecode == 49) || (typecode == 30))) + tfree(pv->v.vec.rVec); + } return (vv); } else { return (if_getstat(ckt, *name));