From f22e8dd970f7bc0e090c13490b6e0b72c3fa81d5 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Tue, 14 Jun 2016 00:52:15 +0200 Subject: [PATCH] b4v5dest.c, b4v6dest.c, remove memory leak --- src/spicelib/devices/bsim4v5/b4v5dest.c | 6 +++++- src/spicelib/devices/bsim4v6/b4v6dest.c | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/spicelib/devices/bsim4v5/b4v5dest.c b/src/spicelib/devices/bsim4v5/b4v5dest.c index 7eea05152..f4677b615 100644 --- a/src/spicelib/devices/bsim4v5/b4v5dest.c +++ b/src/spicelib/devices/bsim4v5/b4v5dest.c @@ -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; diff --git a/src/spicelib/devices/bsim4v6/b4v6dest.c b/src/spicelib/devices/bsim4v6/b4v6dest.c index e68309a56..ed8f1715d 100644 --- a/src/spicelib/devices/bsim4v6/b4v6dest.c +++ b/src/spicelib/devices/bsim4v6/b4v6dest.c @@ -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;