Browse Source

b4v5dest.c, b4v6dest.c, remove memory leak

pre-master-46
h_vogt 10 years ago
committed by rlar
parent
commit
f22e8dd970
  1. 6
      src/spicelib/devices/bsim4v5/b4v5dest.c
  2. 7
      src/spicelib/devices/bsim4v6/b4v6dest.c

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

@ -35,7 +35,10 @@ BSIM4v5destroy(
FREE(pParamOld); FREE(pParamOld);
pParam = NULL; pParam = NULL;
/** end of extra code **/ /** end of extra code **/
if(oldmod) FREE(oldmod);
if (oldmod) {
FREE(oldmod->BSIM4v5version);
FREE(oldmod);
}
oldmod = mod; oldmod = mod;
prev = NULL; prev = NULL;
for (here = mod->BSIM4v5instances; here; here = here->BSIM4v5nextInstance) { for (here = mod->BSIM4v5instances; here; here = here->BSIM4v5nextInstance) {
@ -49,6 +52,7 @@ BSIM4v5destroy(
/* free just once for all models */ /* free just once for all models */
FREE(oldmod->BSIM4v5InstanceArray); FREE(oldmod->BSIM4v5InstanceArray);
#endif #endif
FREE(oldmod->BSIM4v5version);
FREE(oldmod); FREE(oldmod);
} }
*model = NULL; *model = NULL;

7
src/spicelib/devices/bsim4v6/b4v6dest.c

@ -38,8 +38,10 @@ BSIM4v6destroy(
pParam = NULL; pParam = NULL;
/** end of extra code **/ /** end of extra code **/
if(oldmod)
FREE(oldmod);
if (oldmod) {
FREE(oldmod->BSIM4v6version);
FREE(oldmod);
}
oldmod = mod; oldmod = mod;
prev = NULL; prev = NULL;
for (here = mod->BSIM4v6instances; here; here = here->BSIM4v6nextInstance) { for (here = mod->BSIM4v6instances; here; here = here->BSIM4v6nextInstance) {
@ -53,6 +55,7 @@ BSIM4v6destroy(
/* free just once for all models */ /* free just once for all models */
FREE(oldmod->BSIM4v6InstanceArray); FREE(oldmod->BSIM4v6InstanceArray);
#endif #endif
FREE(oldmod->BSIM4v6version);
FREE(oldmod); FREE(oldmod);
} }
*model = NULL; *model = NULL;

Loading…
Cancel
Save