Browse Source

memory leaks reduced

h_vogt 14 years ago
parent
commit
7a2b51b485
  1. 3
      ChangeLog
  2. 50
      src/spicelib/devices/bsim4/b4dest.c
  3. 42
      src/spicelib/devices/bsim4v5/b4v5dest.c

3
ChangeLog

@ -1,3 +1,6 @@
2011-12-30 Holger Vogt
* b4v5dest.c, b4dest.c : memory leaks reduced
2011-12-30 Robert Larice 2011-12-30 Robert Larice
* inpcom.c : * inpcom.c :
cleanup, drop `s_lower' cleanup, drop `s_lower'

50
src/spicelib/devices/bsim4/b4dest.c

@ -16,25 +16,43 @@
void void
BSIM4destroy( 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; *model = NULL;
return; return;
} }

42
src/spicelib/devices/bsim4v5/b4v5dest.c

@ -14,23 +14,35 @@
void void
BSIM4v5destroy( 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); if(oldmod) FREE(oldmod);
*model = NULL; *model = NULL;

Loading…
Cancel
Save