From abbda029e1bf6226c0acd086c75616097ede16fa Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sat, 24 Aug 2013 18:07:37 +0200 Subject: [PATCH] BSIM 4.7.0 plug memory leak during remcirc --- src/spicelib/devices/bsim4/b4dest.c | 7 ++++++- src/spicelib/devices/bsim4/b4set.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/spicelib/devices/bsim4/b4dest.c b/src/spicelib/devices/bsim4/b4dest.c index 013aa6f75..00e1f2163 100644 --- a/src/spicelib/devices/bsim4/b4dest.c +++ b/src/spicelib/devices/bsim4/b4dest.c @@ -37,7 +37,10 @@ BSIM4destroy( FREE(pParamOld); pParam = NULL; /** end of extra code **/ - if(oldmod) FREE(oldmod); + if(oldmod) { + FREE(oldmod->BSIM4version); + FREE(oldmod); + } oldmod = mod; prev = (BSIM4instance *)NULL; for (here = mod->BSIM4instances; here; here = here->BSIM4nextInstance) { @@ -51,6 +54,8 @@ BSIM4destroy( /* free just once for all models */ FREE(oldmod->BSIM4InstanceArray); #endif + /* oldmod->BSIM4modName to be freed in INPtabEnd() */ + FREE(oldmod->BSIM4version); FREE(oldmod); } *model = NULL; diff --git a/src/spicelib/devices/bsim4/b4set.c b/src/spicelib/devices/bsim4/b4set.c index 20e935efb..fd704c99c 100644 --- a/src/spicelib/devices/bsim4/b4set.c +++ b/src/spicelib/devices/bsim4/b4set.c @@ -208,7 +208,7 @@ BSIM4instance **InstArray; } if (!model->BSIM4versionGiven) - model->BSIM4version = "4.7.0"; + model->BSIM4version = copy("4.7.0"); if (!model->BSIM4toxrefGiven) model->BSIM4toxref = 30.0e-10; if (!model->BSIM4eotGiven)