From a17de08b5cb35a2a40b578b578b50fba7c918ef4 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sat, 22 Sep 2018 18:25:06 +0200 Subject: [PATCH] free only value that have been TMALLOCed or TREALLOCed --- src/xspice/mif/mifgetmod.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/xspice/mif/mifgetmod.c b/src/xspice/mif/mifgetmod.c index 49fbfe492..76eddfe5c 100644 --- a/src/xspice/mif/mifgetmod.c +++ b/src/xspice/mif/mifgetmod.c @@ -200,8 +200,14 @@ char *MIFgetMod( ft_sim->devices[modtmp->INPmodType]->modelParms[j].id, val, NULL); /* free val, allocated by MIFgetValue */ - tfree(val->v.vec.rVec); - if (IF_STRING == (ft_sim->devices[modtmp->INPmodType]->modelParms[j].dataType & IF_VARTYPES)) + int vtype = (ft_sim->devices[modtmp->INPmodType]->modelParms[j].dataType & IF_VARTYPES); + if (vtype == IF_FLAGVEC || IF_INTVEC) + tfree(val->v.vec.iVec); + if (vtype == IF_REALVEC) + tfree(val->v.vec.rVec); + if (vtype == IF_CPLXVEC) + tfree(val->v.vec.cVec); + if (vtype == IF_STRING || vtype == IF_STRINGVEC) tfree(val->sValue); if(error) return(INPerror(error));