From d6946705f8f203743a58d1eea061cdd1fea18a28 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sat, 24 Aug 2013 18:06:28 +0200 Subject: [PATCH] BSIM 3.3.0 plug memory leak during remcirc --- src/spicelib/devices/bsim3/b3dest.c | 7 ++++++- src/spicelib/devices/bsim3/b3set.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/spicelib/devices/bsim3/b3dest.c b/src/spicelib/devices/bsim3/b3dest.c index b77ea5082..d01bdb87c 100644 --- a/src/spicelib/devices/bsim3/b3dest.c +++ b/src/spicelib/devices/bsim3/b3dest.c @@ -35,7 +35,10 @@ BSIM3destroy( FREE(pParamOld); pParam = NULL; /** end of extra code **/ - if(oldmod) FREE(oldmod); + if(oldmod) { + FREE(oldmod->BSIM3version); + FREE(oldmod); + } oldmod = mod; prev = NULL; for (here = mod->BSIM3instances; here; here = here->BSIM3nextInstance) { @@ -49,6 +52,8 @@ BSIM3destroy( /* free just once for all models */ FREE(oldmod->BSIM3InstanceArray); #endif + /* oldmod->BSIM3modName to be freed in INPtabEnd() */ + FREE(oldmod->BSIM3version); FREE(oldmod); } *model = NULL; diff --git a/src/spicelib/devices/bsim3/b3set.c b/src/spicelib/devices/bsim3/b3set.c index 46c2b7698..4d2d753be 100644 --- a/src/spicelib/devices/bsim3/b3set.c +++ b/src/spicelib/devices/bsim3/b3set.c @@ -80,7 +80,7 @@ BSIM3instance **InstArray; printf("Warning: acnqsMod has been set to its default value: 0.\n"); } if (!model->BSIM3versionGiven) - model->BSIM3version = "3.3.0"; + model->BSIM3version = copy("3.3.0"); if (!model->BSIM3toxGiven) model->BSIM3tox = 150.0e-10; model->BSIM3cox = 3.453133e-11 / model->BSIM3tox;