memory leaks reduced
This commit is contained in:
parent
f1b516f1b1
commit
7a2b51b485
|
|
@ -1,3 +1,6 @@
|
|||
2011-12-30 Holger Vogt
|
||||
* b4v5dest.c, b4dest.c : memory leaks reduced
|
||||
|
||||
2011-12-30 Robert Larice
|
||||
* inpcom.c :
|
||||
cleanup, drop `s_lower'
|
||||
|
|
|
|||
|
|
@ -16,25 +16,43 @@
|
|||
|
||||
void
|
||||
BSIM4destroy(
|
||||
GENmodel **inModel)
|
||||
GENmodel **inModel)
|
||||
{
|
||||
BSIM4model **model = (BSIM4model**)inModel;
|
||||
BSIM4instance *here;
|
||||
BSIM4instance *prev = NULL;
|
||||
BSIM4model *mod = *model;
|
||||
BSIM4model *oldmod = NULL;
|
||||
BSIM4model **model = (BSIM4model**)inModel;
|
||||
BSIM4instance *here;
|
||||
BSIM4instance *prev = NULL;
|
||||
BSIM4model *mod = *model;
|
||||
BSIM4model *oldmod = NULL;
|
||||
|
||||
for (; mod ; mod = mod->BSIM4nextModel)
|
||||
{ if(oldmod) FREE(oldmod);
|
||||
oldmod = mod;
|
||||
prev = (BSIM4instance *)NULL;
|
||||
for (here = mod->BSIM4instances; here; here = here->BSIM4nextInstance)
|
||||
{ if(prev) FREE(prev);
|
||||
prev = here;
|
||||
}
|
||||
if(prev) FREE(prev);
|
||||
for (; mod ; mod = mod->BSIM4nextModel) {
|
||||
/** added to get rid of link list pSizeDependParamKnot **/
|
||||
struct bsim4SizeDependParam *pParam, *pParamOld=NULL;
|
||||
|
||||
pParam = mod->pSizeDependParamKnot;
|
||||
|
||||
for (; pParam ; pParam = pParam->pNext) {
|
||||
FREE(pParamOld);
|
||||
pParamOld = pParam;
|
||||
}
|
||||
FREE(pParamOld);
|
||||
pParam = NULL;
|
||||
/** end of extra code **/
|
||||
if(oldmod) FREE(oldmod);
|
||||
oldmod = mod;
|
||||
prev = (BSIM4instance *)NULL;
|
||||
for (here = mod->BSIM4instances; here; here = here->BSIM4nextInstance) {
|
||||
if(prev) FREE(prev);
|
||||
prev = here;
|
||||
}
|
||||
if(prev) FREE(prev);
|
||||
}
|
||||
if(oldmod) {
|
||||
#ifdef USE_OMP4
|
||||
/* free just once for all models */
|
||||
FREE(oldmod->BSIM4InstanceArray);
|
||||
#endif
|
||||
FREE(oldmod);
|
||||
}
|
||||
if(oldmod) FREE(oldmod);
|
||||
*model = NULL;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,23 +14,35 @@
|
|||
|
||||
void
|
||||
BSIM4v5destroy(
|
||||
GENmodel **inModel)
|
||||
GENmodel **inModel)
|
||||
{
|
||||
BSIM4v5model **model = (BSIM4v5model**)inModel;
|
||||
BSIM4v5instance *here;
|
||||
BSIM4v5instance *prev = NULL;
|
||||
BSIM4v5model *mod = *model;
|
||||
BSIM4v5model *oldmod = NULL;
|
||||
BSIM4v5model **model = (BSIM4v5model**)inModel;
|
||||
BSIM4v5instance *here;
|
||||
BSIM4v5instance *prev = NULL;
|
||||
BSIM4v5model *mod = *model;
|
||||
BSIM4v5model *oldmod = NULL;
|
||||
|
||||
for (; mod ; mod = mod->BSIM4v5nextModel)
|
||||
{ if(oldmod) FREE(oldmod);
|
||||
oldmod = mod;
|
||||
prev = NULL;
|
||||
for (here = mod->BSIM4v5instances; here; here = here->BSIM4v5nextInstance)
|
||||
{ if(prev) FREE(prev);
|
||||
prev = here;
|
||||
}
|
||||
if(prev) FREE(prev);
|
||||
for (; mod ; mod = mod->BSIM4v5nextModel) {
|
||||
/** added to get rid of link list pSizeDependParamKnot **/
|
||||
struct bsim4v5SizeDependParam *pParam, *pParamOld=NULL;
|
||||
|
||||
pParam = mod->pSizeDependParamKnot;
|
||||
|
||||
for (; pParam ; pParam = pParam->pNext) {
|
||||
FREE(pParamOld);
|
||||
pParamOld = pParam;
|
||||
}
|
||||
FREE(pParamOld);
|
||||
pParam = NULL;
|
||||
/** end of extra code **/
|
||||
if(oldmod) FREE(oldmod);
|
||||
oldmod = mod;
|
||||
prev = NULL;
|
||||
for (here = mod->BSIM4v5instances; here; here = here->BSIM4v5nextInstance) {
|
||||
if(prev) FREE(prev);
|
||||
prev = here;
|
||||
}
|
||||
if(prev) FREE(prev);
|
||||
}
|
||||
if(oldmod) FREE(oldmod);
|
||||
*model = NULL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue