b4v5dest.c, b4v6dest.c, remove memory leak

This commit is contained in:
h_vogt 2016-06-14 00:52:15 +02:00 committed by rlar
parent f997203c6d
commit f22e8dd970
2 changed files with 10 additions and 3 deletions

View File

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

View File

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