diff --git a/src/spicelib/devices/asrc/asrcdel.c b/src/spicelib/devices/asrc/asrcdel.c index 40f3f15a3..f99be7186 100644 --- a/src/spicelib/devices/asrc/asrcdel.c +++ b/src/spicelib/devices/asrc/asrcdel.c @@ -6,6 +6,7 @@ Author: 1987 Kanwar Jit Singh #include "ngspice/ngspice.h" #include "asrcdefs.h" #include "ngspice/sperror.h" +#include "ngspice/inpdefs.h" #include "ngspice/suffix.h" @@ -14,6 +15,9 @@ ASRCdelete(GENinstance *gen_inst) { ASRCinstance *inst = (ASRCinstance *) gen_inst; + INPfreeTree(inst->ASRCtree); FREE(inst->ASRCacValues); + FREE(inst->ASRCposPtr); + FREE(inst->ASRCvars); return OK; } diff --git a/src/spicelib/devices/asrc/asrcdest.c b/src/spicelib/devices/asrc/asrcdest.c index 9289cfd66..e95ce3170 100644 --- a/src/spicelib/devices/asrc/asrcdest.c +++ b/src/spicelib/devices/asrc/asrcdest.c @@ -6,7 +6,6 @@ Author: 1987 Kanwar Jit Singh #include "ngspice/ngspice.h" #include "asrcdefs.h" #include "ngspice/suffix.h" -#include "ngspice/inpdefs.h" void @@ -19,10 +18,6 @@ ASRCdestroy(GENmodel **inModel) ASRCinstance *inst = mod->ASRCinstances; while (inst) { ASRCinstance *next_inst = inst->ASRCnextInstance; - INPfreeTree(inst->ASRCtree); - FREE(inst->ASRCacValues); - FREE(inst->ASRCposPtr); - FREE(inst->ASRCvars); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bjt/bjtdel.c b/src/spicelib/devices/bjt/bjtdel.c index 4958fda27..05c8b5dae 100644 --- a/src/spicelib/devices/bjt/bjtdel.c +++ b/src/spicelib/devices/bjt/bjtdel.c @@ -17,6 +17,7 @@ Author: 1985 Thomas L. Quarles int BJTdelete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + BJTinstance *inst = (BJTinstance *) gen_inst; + FREE(inst->BJTsens); return OK; } diff --git a/src/spicelib/devices/bjt/bjtdest.c b/src/spicelib/devices/bjt/bjtdest.c index 20f4e213d..354017323 100644 --- a/src/spicelib/devices/bjt/bjtdest.c +++ b/src/spicelib/devices/bjt/bjtdest.c @@ -23,7 +23,6 @@ BJTdestroy(GENmodel **inModel) BJTinstance *inst = mod->BJTinstances; while (inst) { BJTinstance *next_inst = inst->BJTnextInstance; - FREE(inst->BJTsens); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/bsim3/b3dest.c b/src/spicelib/devices/bsim3/b3dest.c index 2c0b83256..b49fbd154 100644 --- a/src/spicelib/devices/bsim3/b3dest.c +++ b/src/spicelib/devices/bsim3/b3dest.c @@ -22,27 +22,12 @@ BSIM3destroy(GENmodel **inModel) BSIM3model *next_mod = mod->BSIM3nextModel; BSIM3instance *inst = mod->BSIM3instances; - /** added to get rid of link list pSizeDependParamKnot **/ - struct bsim3SizeDependParam *p = mod->pSizeDependParamKnot; - while (p) { - struct bsim3SizeDependParam *next_p = p->pNext; - FREE(p); - p = next_p; - } - /** end of extra code **/ - while (inst) { BSIM3instance *next_inst = inst->BSIM3nextInstance; FREE(inst); inst = next_inst; } -#ifdef USE_OMP - FREE(mod->BSIM3InstanceArray); -#endif - - /* mod->BSIM3modName to be freed in INPtabEnd() */ - FREE(mod->BSIM3version); FREE(mod); mod = next_mod; } diff --git a/src/spicelib/devices/bsim3/b3mdel.c b/src/spicelib/devices/bsim3/b3mdel.c index 91fcaa0ba..33d7b7faa 100644 --- a/src/spicelib/devices/bsim3/b3mdel.c +++ b/src/spicelib/devices/bsim3/b3mdel.c @@ -17,6 +17,21 @@ int BSIM3mDelete(GENmodel *gen_model) { - NG_IGNORE(gen_model); + BSIM3model *model = (BSIM3model*) gen_model; + +#ifdef USE_OMP + FREE(model->BSIM3InstanceArray); +#endif + + struct bsim3SizeDependParam *p = model->pSizeDependParamKnot; + while (p) { + struct bsim3SizeDependParam *next_p = p->pNext; + FREE(p); + p = next_p; + } + + /* model->BSIM3modName to be freed in INPtabEnd() */ + FREE(model->BSIM3version); + return OK; } diff --git a/src/spicelib/devices/bsim3v32/b3v32dest.c b/src/spicelib/devices/bsim3v32/b3v32dest.c index e71fe15a4..461c16436 100644 --- a/src/spicelib/devices/bsim3v32/b3v32dest.c +++ b/src/spicelib/devices/bsim3v32/b3v32dest.c @@ -22,25 +22,12 @@ BSIM3v32destroy (GENmodel **inModel) while (mod) { BSIM3v32model *next_mod = mod->BSIM3v32nextModel; BSIM3v32instance *inst = mod->BSIM3v32instances; - /** added to get rid of link list pSizeDependParamKnot **/ - struct bsim3v32SizeDependParam *p = mod->pSizeDependParamKnot; - while (p) { - struct bsim3v32SizeDependParam *next_p = p->pNext; - FREE(p); - p = next_p; - } - /** end of extra code **/ while (inst) { BSIM3v32instance *next_inst = inst->BSIM3v32nextInstance; FREE(inst); inst = next_inst; } -#ifdef USE_OMP - FREE(mod->BSIM3v32InstanceArray); -#endif - - FREE(mod->BSIM3v32version); FREE(mod); mod = next_mod; } diff --git a/src/spicelib/devices/bsim3v32/b3v32mdel.c b/src/spicelib/devices/bsim3v32/b3v32mdel.c index 3dc07b10d..bc119f1d1 100644 --- a/src/spicelib/devices/bsim3v32/b3v32mdel.c +++ b/src/spicelib/devices/bsim3v32/b3v32mdel.c @@ -18,6 +18,20 @@ int BSIM3v32mDelete(GENmodel *gen_model) { - NG_IGNORE(gen_model); + BSIM3v32model *model = (BSIM3v32model *) gen_model; + +#ifdef USE_OMP + FREE(model->BSIM3v32InstanceArray); +#endif + + struct bsim3v32SizeDependParam *p = model->pSizeDependParamKnot; + while (p) { + struct bsim3v32SizeDependParam *next_p = p->pNext; + FREE(p); + p = next_p; + } + + FREE(model->BSIM3v32version); + return OK; } diff --git a/src/spicelib/devices/bsim4/b4dest.c b/src/spicelib/devices/bsim4/b4dest.c index c6f1c46ab..e8290159b 100644 --- a/src/spicelib/devices/bsim4/b4dest.c +++ b/src/spicelib/devices/bsim4/b4dest.c @@ -71,25 +71,12 @@ BSIM4destroy(GENmodel **inModel) while (mod) { BSIM4model *next_mod = mod->BSIM4nextModel; BSIM4instance *inst = mod->BSIM4instances; - /** added to get rid of link list pSizeDependParamKnot **/ - struct bsim4SizeDependParam *p = mod->pSizeDependParamKnot; - while (p) { - struct bsim4SizeDependParam *next_p = p->pNext; - FREE(p); - p = next_p; - } - /** end of extra code **/ while (inst) { BSIM4instance *next_inst = inst->BSIM4nextInstance; FREE(inst); inst = next_inst; } -#ifdef USE_OMP - FREE(mod->BSIM4InstanceArray); -#endif - - FREE(mod->BSIM4version); FREE(mod); mod = next_mod; } diff --git a/src/spicelib/devices/bsim4/b4mdel.c b/src/spicelib/devices/bsim4/b4mdel.c index b936b98e3..5acc6e375 100644 --- a/src/spicelib/devices/bsim4/b4mdel.c +++ b/src/spicelib/devices/bsim4/b4mdel.c @@ -67,6 +67,20 @@ int BSIM4mDelete(GENmodel *gen_model) { - NG_IGNORE(gen_model); + BSIM4model *model = (BSIM4model *) gen_model; + +#ifdef USE_OMP + FREE(model->BSIM4InstanceArray); +#endif + + struct bsim4SizeDependParam *p = model->pSizeDependParamKnot; + while (p) { + struct bsim4SizeDependParam *next_p = p->pNext; + FREE(p); + p = next_p; + } + + FREE(model->BSIM4version); + return OK; } diff --git a/src/spicelib/devices/bsim4v5/b4v5dest.c b/src/spicelib/devices/bsim4v5/b4v5dest.c index ff4071263..588383399 100644 --- a/src/spicelib/devices/bsim4v5/b4v5dest.c +++ b/src/spicelib/devices/bsim4v5/b4v5dest.c @@ -21,25 +21,12 @@ BSIM4v5destroy(GENmodel **inModel) while (mod) { BSIM4v5model *next_mod = mod->BSIM4v5nextModel; BSIM4v5instance *inst = mod->BSIM4v5instances; - /** added to get rid of link list pSizeDependParamKnot **/ - struct bsim4v5SizeDependParam *p = mod->pSizeDependParamKnot; - while (p) { - struct bsim4v5SizeDependParam *next_p = p->pNext; - FREE(p); - p = next_p; - } - /** end of extra code **/ while (inst) { BSIM4v5instance *next_inst = inst->BSIM4v5nextInstance; FREE(inst); inst = next_inst; } -#ifdef USE_OMP - FREE(mod->BSIM4v5InstanceArray); -#endif - - FREE(mod->BSIM4v5version); FREE(mod); mod = next_mod; } diff --git a/src/spicelib/devices/bsim4v5/b4v5mdel.c b/src/spicelib/devices/bsim4v5/b4v5mdel.c index 9b62f55fa..6de1fdfa5 100644 --- a/src/spicelib/devices/bsim4v5/b4v5mdel.c +++ b/src/spicelib/devices/bsim4v5/b4v5mdel.c @@ -17,6 +17,20 @@ int BSIM4v5mDelete(GENmodel *gen_model) { - NG_IGNORE(gen_model); + BSIM4v5model *model = (BSIM4v5model*) gen_model; + +#ifdef USE_OMP + FREE(model->BSIM4v5InstanceArray); +#endif + + struct bsim4v5SizeDependParam *p = model->pSizeDependParamKnot; + while (p) { + struct bsim4v5SizeDependParam *next_p = p->pNext; + FREE(p); + p = next_p; + } + + FREE(model->BSIM4v5version); + return OK; } diff --git a/src/spicelib/devices/bsim4v6/b4v6dest.c b/src/spicelib/devices/bsim4v6/b4v6dest.c index 3db294dd9..854872b0f 100644 --- a/src/spicelib/devices/bsim4v6/b4v6dest.c +++ b/src/spicelib/devices/bsim4v6/b4v6dest.c @@ -23,25 +23,12 @@ BSIM4v6destroy(GENmodel **inModel) while (mod) { BSIM4v6model *next_mod = mod->BSIM4v6nextModel; BSIM4v6instance *inst = mod->BSIM4v6instances; - /** added to get rid of link list pSizeDependParamKnot **/ - struct bsim4v6SizeDependParam *p = mod->pSizeDependParamKnot; - while (p) { - struct bsim4v6SizeDependParam *next_p = p->pNext; - FREE(p); - p = next_p; - } - /** end of extra code **/ while (inst) { BSIM4v6instance *next_inst = inst->BSIM4v6nextInstance; FREE(inst); inst = next_inst; } -#ifdef USE_OMP - FREE(mod->BSIM4v6InstanceArray); -#endif - - FREE(mod->BSIM4v6version); FREE(mod); mod = next_mod; } diff --git a/src/spicelib/devices/bsim4v6/b4v6mdel.c b/src/spicelib/devices/bsim4v6/b4v6mdel.c index 8d03a77c2..48f1c36e2 100644 --- a/src/spicelib/devices/bsim4v6/b4v6mdel.c +++ b/src/spicelib/devices/bsim4v6/b4v6mdel.c @@ -19,6 +19,20 @@ int BSIM4v6mDelete(GENmodel *gen_model) { - NG_IGNORE(gen_model); + BSIM4v6model *model = (BSIM4v6model *) gen_model; + +#ifdef USE_OMP + FREE(model->BSIM4v6InstanceArray); +#endif + + struct bsim4v6SizeDependParam *p = model->pSizeDependParamKnot; + while (p) { + struct bsim4v6SizeDependParam *next_p = p->pNext; + FREE(p); + p = next_p; + } + + FREE(model->BSIM4v6version); + return OK; } diff --git a/src/spicelib/devices/bsim4v7/b4v7dest.c b/src/spicelib/devices/bsim4v7/b4v7dest.c index 3a19dcee0..939309d5e 100644 --- a/src/spicelib/devices/bsim4v7/b4v7dest.c +++ b/src/spicelib/devices/bsim4v7/b4v7dest.c @@ -23,26 +23,12 @@ BSIM4v7destroy(GENmodel **inModel) while (mod) { BSIM4v7model *next_mod = mod->BSIM4v7nextModel; BSIM4v7instance *inst = mod->BSIM4v7instances; - /** added to get rid of link list pSizeDependParamKnot **/ - struct bsim4SizeDependParam *p = mod->pSizeDependParamKnot; - while (p) { - struct bsim4SizeDependParam *next_p = p->pNext; - FREE(p); - p = next_p; - } - /** end of extra code **/ while (inst) { BSIM4v7instance *next_inst = inst->BSIM4v7nextInstance; FREE(inst); inst = next_inst; } -#ifdef USE_OMP - FREE(mod->BSIM4v7InstanceArray); -#endif - - /* mod->BSIM4v7modName to be freed in INPtabEnd() */ - FREE(mod->BSIM4v7version); FREE(mod); mod = next_mod; } diff --git a/src/spicelib/devices/bsim4v7/b4v7mdel.c b/src/spicelib/devices/bsim4v7/b4v7mdel.c index 2cb348d98..198f08fee 100644 --- a/src/spicelib/devices/bsim4v7/b4v7mdel.c +++ b/src/spicelib/devices/bsim4v7/b4v7mdel.c @@ -19,6 +19,21 @@ int BSIM4v7mDelete(GENmodel *gen_model) { - NG_IGNORE(gen_model); + BSIM4v7model *model = (BSIM4v7model *) gen_model; + +#ifdef USE_OMP + FREE(model->BSIM4v7InstanceArray); +#endif + + struct bsim4SizeDependParam *p = model->pSizeDependParamKnot; + while (p) { + struct bsim4SizeDependParam *next_p = p->pNext; + FREE(p); + p = next_p; + } + + /* model->BSIM4v7modName to be freed in INPtabEnd() */ + FREE(model->BSIM4v7version); + return OK; } diff --git a/src/spicelib/devices/bsimsoi/b4soidest.c b/src/spicelib/devices/bsimsoi/b4soidest.c index 55cde8318..e9fda113d 100644 --- a/src/spicelib/devices/bsimsoi/b4soidest.c +++ b/src/spicelib/devices/bsimsoi/b4soidest.c @@ -33,10 +33,6 @@ B4SOIdestroy(GENmodel **inModel) inst = next_inst; } -#ifdef USE_OMP - FREE(mod->B4SOIInstanceArray); -#endif - FREE(mod); mod = next_mod; } diff --git a/src/spicelib/devices/bsimsoi/b4soimdel.c b/src/spicelib/devices/bsimsoi/b4soimdel.c index 853573358..b141382e4 100644 --- a/src/spicelib/devices/bsimsoi/b4soimdel.c +++ b/src/spicelib/devices/bsimsoi/b4soimdel.c @@ -24,5 +24,11 @@ int B4SOImDelete(GENmodel *gen_model) { NG_IGNORE(gen_model); + +#ifdef USE_OMP + B4SOImodel *model = (B4SOImodel *) gen_model; + FREE(model->B4SOIInstanceArray); +#endif + return OK; } diff --git a/src/spicelib/devices/hisim2/hsm2dest.c b/src/spicelib/devices/hisim2/hsm2dest.c index 99c1d57cb..84b150e46 100644 --- a/src/spicelib/devices/hisim2/hsm2dest.c +++ b/src/spicelib/devices/hisim2/hsm2dest.c @@ -73,10 +73,6 @@ HSM2destroy(GENmodel **inModel) inst = next_inst; } -#ifdef USE_OMP - FREE(mod->HSM2InstanceArray); -#endif - FREE(mod); mod = next_mod; } diff --git a/src/spicelib/devices/hisim2/hsm2mdel.c b/src/spicelib/devices/hisim2/hsm2mdel.c index 02f7352de..bd9331fb6 100644 --- a/src/spicelib/devices/hisim2/hsm2mdel.c +++ b/src/spicelib/devices/hisim2/hsm2mdel.c @@ -64,5 +64,11 @@ int HSM2mDelete(GENmodel *gen_model) { NG_IGNORE(gen_model); + +#ifdef USE_OMP + HSM2model *model = (HSM2model *) gen_model; + FREE(model->HSM2InstanceArray); +#endif + return OK; } diff --git a/src/spicelib/devices/isrc/isrcdel.c b/src/spicelib/devices/isrc/isrcdel.c index cbf3b0bc2..c2b6f6c33 100644 --- a/src/spicelib/devices/isrc/isrcdel.c +++ b/src/spicelib/devices/isrc/isrcdel.c @@ -12,6 +12,9 @@ Author: 1985 Thomas L. Quarles int ISRCdelete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + ISRCinstance *inst = (ISRCinstance *) gen_inst; + + FREE(inst->ISRCcoeffs); + return OK; } diff --git a/src/spicelib/devices/isrc/isrcdest.c b/src/spicelib/devices/isrc/isrcdest.c index ca9cb3058..91932bf93 100644 --- a/src/spicelib/devices/isrc/isrcdest.c +++ b/src/spicelib/devices/isrc/isrcdest.c @@ -18,7 +18,6 @@ ISRCdestroy(GENmodel **inModel) ISRCinstance *inst = mod->ISRCinstances; while (inst) { ISRCinstance *next_inst = inst->ISRCnextInstance; - FREE(inst->ISRCcoeffs); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/mos1/mos1del.c b/src/spicelib/devices/mos1/mos1del.c index 2a7b36532..88465b701 100644 --- a/src/spicelib/devices/mos1/mos1del.c +++ b/src/spicelib/devices/mos1/mos1del.c @@ -12,6 +12,7 @@ Author: 1985 Thomas L. Quarles int MOS1delete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + MOS1instance *inst = (MOS1instance *) gen_inst; + FREE(inst->MOS1sens); return OK; } diff --git a/src/spicelib/devices/mos1/mos1dest.c b/src/spicelib/devices/mos1/mos1dest.c index b862a7b60..238a45450 100644 --- a/src/spicelib/devices/mos1/mos1dest.c +++ b/src/spicelib/devices/mos1/mos1dest.c @@ -18,7 +18,6 @@ MOS1destroy(GENmodel **inModel) MOS1instance *inst = mod->MOS1instances; while (inst) { MOS1instance *next_inst = inst->MOS1nextInstance; - FREE(inst->MOS1sens); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/mos2/mos2del.c b/src/spicelib/devices/mos2/mos2del.c index c8e8843a8..48ace59e3 100644 --- a/src/spicelib/devices/mos2/mos2del.c +++ b/src/spicelib/devices/mos2/mos2del.c @@ -12,6 +12,7 @@ Author: 1985 Thomas L. Quarles int MOS2delete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + MOS2instance *inst = (MOS2instance *) gen_inst; + FREE(inst->MOS2sens); return OK; } diff --git a/src/spicelib/devices/mos2/mos2dest.c b/src/spicelib/devices/mos2/mos2dest.c index eb78eca02..0a61bf223 100644 --- a/src/spicelib/devices/mos2/mos2dest.c +++ b/src/spicelib/devices/mos2/mos2dest.c @@ -18,7 +18,6 @@ MOS2destroy(GENmodel **inModel) MOS2instance *inst = mod->MOS2instances; while (inst) { MOS2instance *next_inst = inst->MOS2nextInstance; - FREE(inst->MOS2sens); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/mos3/mos3del.c b/src/spicelib/devices/mos3/mos3del.c index c150fdc28..e1fa9e76c 100644 --- a/src/spicelib/devices/mos3/mos3del.c +++ b/src/spicelib/devices/mos3/mos3del.c @@ -12,6 +12,7 @@ Author: 1985 Thomas L. Quarles int MOS3delete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + MOS3instance *inst = (MOS3instance *) gen_inst; + FREE(inst->MOS3sens); return OK; } diff --git a/src/spicelib/devices/mos3/mos3dest.c b/src/spicelib/devices/mos3/mos3dest.c index 5adf9f786..0a9edda64 100644 --- a/src/spicelib/devices/mos3/mos3dest.c +++ b/src/spicelib/devices/mos3/mos3dest.c @@ -18,7 +18,6 @@ MOS3destroy(GENmodel **inModel) MOS3instance *inst = mod->MOS3instances; while (inst) { MOS3instance *next_inst = inst->MOS3nextInstance; - FREE(inst->MOS3sens); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/mos6/mos6del.c b/src/spicelib/devices/mos6/mos6del.c index 74a43a92d..d98554482 100644 --- a/src/spicelib/devices/mos6/mos6del.c +++ b/src/spicelib/devices/mos6/mos6del.c @@ -12,6 +12,7 @@ Author: 1985 Thomas L. Quarles int MOS6delete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + MOS6instance *inst = (MOS6instance *) gen_inst; + FREE(inst->MOS6sens); return OK; } diff --git a/src/spicelib/devices/mos6/mos6dest.c b/src/spicelib/devices/mos6/mos6dest.c index 09af2c252..a3ff85867 100644 --- a/src/spicelib/devices/mos6/mos6dest.c +++ b/src/spicelib/devices/mos6/mos6dest.c @@ -18,7 +18,6 @@ MOS6destroy(GENmodel **inModel) MOS6instance *inst = mod->MOS6instances; while (inst) { MOS6instance *next_inst = inst->MOS6nextInstance; - FREE(inst->MOS6sens); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/mos9/mos9del.c b/src/spicelib/devices/mos9/mos9del.c index 89205d2da..f2f8b669f 100644 --- a/src/spicelib/devices/mos9/mos9del.c +++ b/src/spicelib/devices/mos9/mos9del.c @@ -13,6 +13,7 @@ Modified: Alan Gillespie int MOS9delete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + MOS9instance *inst = (MOS9instance *) gen_inst; + FREE(inst->MOS9sens); return OK; } diff --git a/src/spicelib/devices/mos9/mos9dest.c b/src/spicelib/devices/mos9/mos9dest.c index 9319181d6..14839ac68 100644 --- a/src/spicelib/devices/mos9/mos9dest.c +++ b/src/spicelib/devices/mos9/mos9dest.c @@ -19,7 +19,6 @@ MOS9destroy(GENmodel **inModel) MOS9instance *inst = mod->MOS9instances; while (inst) { MOS9instance *next_inst = inst->MOS9nextInstance; - FREE(inst->MOS9sens); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/nbjt/nbjtdel.c b/src/spicelib/devices/nbjt/nbjtdel.c index 3854bae80..b4997932e 100644 --- a/src/spicelib/devices/nbjt/nbjtdel.c +++ b/src/spicelib/devices/nbjt/nbjtdel.c @@ -10,6 +10,7 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group #include "ngspice/ngspice.h" #include "nbjtdefs.h" +#include "../../../ciderlib/oned/onedext.h" #include "ngspice/sperror.h" #include "ngspice/suffix.h" @@ -17,6 +18,9 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group int NBJTdelete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + NBJTinstance *inst = (NBJTinstance *) gen_inst; + + ONEdestroy(inst->NBJTpDevice); + return OK; } diff --git a/src/spicelib/devices/nbjt/nbjtdest.c b/src/spicelib/devices/nbjt/nbjtdest.c index 48c7bd749..634562847 100644 --- a/src/spicelib/devices/nbjt/nbjtdest.c +++ b/src/spicelib/devices/nbjt/nbjtdest.c @@ -10,8 +10,6 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group #include "ngspice/ngspice.h" #include "nbjtdefs.h" -#include "../../../ciderlib/oned/onedext.h" -#include "ngspice/cidersupt.h" #include "ngspice/suffix.h" @@ -25,7 +23,6 @@ NBJTdestroy(GENmodel **inModel) NBJTinstance *inst = mod->NBJTinstances; while (inst) { NBJTinstance *next_inst = inst->NBJTnextInstance; - ONEdestroy(inst->NBJTpDevice); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/nbjt2/nbt2del.c b/src/spicelib/devices/nbjt2/nbt2del.c index 783360712..4288abe46 100644 --- a/src/spicelib/devices/nbjt2/nbt2del.c +++ b/src/spicelib/devices/nbjt2/nbt2del.c @@ -10,6 +10,8 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group #include "ngspice/ngspice.h" #include "nbjt2def.h" +#include "../../../ciderlib/twod/twoddefs.h" +#include "../../../ciderlib/twod/twodext.h" #include "ngspice/sperror.h" #include "ngspice/suffix.h" @@ -17,6 +19,9 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group int NBJT2delete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + NBJT2instance *inst = (NBJT2instance *) gen_inst; + + TWOdestroy(inst->NBJT2pDevice); + return OK; } diff --git a/src/spicelib/devices/nbjt2/nbt2dest.c b/src/spicelib/devices/nbjt2/nbt2dest.c index 24853a594..8d35f8d1b 100644 --- a/src/spicelib/devices/nbjt2/nbt2dest.c +++ b/src/spicelib/devices/nbjt2/nbt2dest.c @@ -10,8 +10,6 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group #include "ngspice/ngspice.h" #include "nbjt2def.h" -#include "../../../ciderlib/twod/twoddefs.h" -#include "../../../ciderlib/twod/twodext.h" #include "ngspice/suffix.h" @@ -25,7 +23,6 @@ NBJT2destroy(GENmodel **inModel) NBJT2instance *inst = mod->NBJT2instances; while (inst) { NBJT2instance *next_inst = inst->NBJT2nextInstance; - TWOdestroy(inst->NBJT2pDevice); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/ndev/ndevdest.c b/src/spicelib/devices/ndev/ndevdest.c index 6b1774e30..141da62c5 100644 --- a/src/spicelib/devices/ndev/ndevdest.c +++ b/src/spicelib/devices/ndev/ndevdest.c @@ -22,8 +22,6 @@ NDEVdestroy(GENmodel **inModel) FREE(inst); inst = next_inst; } - close(mod->sock); - printf("Disconnect to remote NDEV server %s:%d\n", mod->host, mod->port); FREE(mod); mod = next_mod; } diff --git a/src/spicelib/devices/ndev/ndevmdel.c b/src/spicelib/devices/ndev/ndevmdel.c index 62fe1aefe..13890f86c 100644 --- a/src/spicelib/devices/ndev/ndevmdel.c +++ b/src/spicelib/devices/ndev/ndevmdel.c @@ -12,6 +12,10 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group int NDEVmDelete(GENmodel *gen_model) { - NG_IGNORE(gen_model); + NDEVmodel *model = (NDEVmodel *) gen_model; + + close(model->sock); + printf("Disconnect to remote NDEV server %s:%d\n", model->host, model->port); + return OK; } diff --git a/src/spicelib/devices/numd/numddel.c b/src/spicelib/devices/numd/numddel.c index 99fea620e..fb1a42839 100644 --- a/src/spicelib/devices/numd/numddel.c +++ b/src/spicelib/devices/numd/numddel.c @@ -5,6 +5,7 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group #include "ngspice/ngspice.h" #include "numddefs.h" +#include "../../../ciderlib/oned/onedext.h" #include "ngspice/sperror.h" #include "ngspice/suffix.h" @@ -12,6 +13,9 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group int NUMDdelete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + NUMDinstance *inst = (NUMDinstance *) gen_inst; + + ONEdestroy(inst->NUMDpDevice); + return OK; } diff --git a/src/spicelib/devices/numd/numddest.c b/src/spicelib/devices/numd/numddest.c index b3422a8ee..5b57327cd 100644 --- a/src/spicelib/devices/numd/numddest.c +++ b/src/spicelib/devices/numd/numddest.c @@ -10,8 +10,6 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group #include "ngspice/ngspice.h" #include "numddefs.h" -#include "../../../ciderlib/oned/onedext.h" -#include "ngspice/cidersupt.h" #include "ngspice/suffix.h" @@ -25,7 +23,6 @@ NUMDdestroy(GENmodel **inModel) NUMDinstance *inst = mod->NUMDinstances; while (inst) { NUMDinstance *next_inst = inst->NUMDnextInstance; - ONEdestroy(inst->NUMDpDevice); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/numd2/nud2del.c b/src/spicelib/devices/numd2/nud2del.c index f3be27796..42d0ffdb8 100644 --- a/src/spicelib/devices/numd2/nud2del.c +++ b/src/spicelib/devices/numd2/nud2del.c @@ -5,6 +5,8 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group #include "ngspice/ngspice.h" #include "numd2def.h" +#include "../../../ciderlib/twod/twoddefs.h" +#include "../../../ciderlib/twod/twodext.h" #include "ngspice/sperror.h" #include "ngspice/suffix.h" @@ -12,6 +14,9 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group int NUMD2delete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + NUMD2instance *inst = (NUMD2instance *) gen_inst; + + TWOdestroy(inst->NUMD2pDevice); + return OK; } diff --git a/src/spicelib/devices/numd2/nud2dest.c b/src/spicelib/devices/numd2/nud2dest.c index 1ad97f0bc..ad80b2070 100644 --- a/src/spicelib/devices/numd2/nud2dest.c +++ b/src/spicelib/devices/numd2/nud2dest.c @@ -10,9 +10,6 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group #include "ngspice/ngspice.h" #include "numd2def.h" -#include "../../../ciderlib/twod/twoddefs.h" -#include "../../../ciderlib/twod/twodext.h" -#include "ngspice/cidersupt.h" #include "ngspice/suffix.h" @@ -26,7 +23,6 @@ NUMD2destroy(GENmodel **inModel) NUMD2instance *inst = mod->NUMD2instances; while (inst) { NUMD2instance *next_inst = inst->NUMD2nextInstance; - TWOdestroy(inst->NUMD2pDevice); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/numos/nummdel.c b/src/spicelib/devices/numos/nummdel.c index 5603c9730..850c806da 100644 --- a/src/spicelib/devices/numos/nummdel.c +++ b/src/spicelib/devices/numos/nummdel.c @@ -10,6 +10,8 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group #include "ngspice/ngspice.h" #include "numosdef.h" +#include "../../../ciderlib/twod/twoddefs.h" +#include "../../../ciderlib/twod/twodext.h" #include "ngspice/sperror.h" #include "ngspice/suffix.h" @@ -17,6 +19,9 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group int NUMOSdelete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + NUMOSinstance *inst = (NUMOSinstance *) gen_inst; + + TWOdestroy(inst->NUMOSpDevice); + return OK; } diff --git a/src/spicelib/devices/numos/nummdest.c b/src/spicelib/devices/numos/nummdest.c index 887208312..44bbdb70f 100644 --- a/src/spicelib/devices/numos/nummdest.c +++ b/src/spicelib/devices/numos/nummdest.c @@ -10,8 +10,6 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group #include "ngspice/ngspice.h" #include "numosdef.h" -#include "../../../ciderlib/twod/twoddefs.h" -#include "../../../ciderlib/twod/twodext.h" #include "ngspice/suffix.h" @@ -25,7 +23,6 @@ NUMOSdestroy(GENmodel **inModel) NUMOSinstance *inst = mod->NUMOSinstances; while (inst) { NUMOSinstance *next_inst = inst->NUMOSnextInstance; - TWOdestroy(inst->NUMOSpDevice); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/soi3/soi3del.c b/src/spicelib/devices/soi3/soi3del.c index f19d0e607..55d5b3fda 100644 --- a/src/spicelib/devices/soi3/soi3del.c +++ b/src/spicelib/devices/soi3/soi3del.c @@ -30,5 +30,10 @@ int SOI3delete(GENinstance *gen_inst) { NG_IGNORE(gen_inst); +#if 0 + /* fixme, why not ? */ + SOI3instance *inst = (SOI3instance *) gen_inst; + FREE(inst->SOI3sens); +#endif return OK; } diff --git a/src/spicelib/devices/soi3/soi3dest.c b/src/spicelib/devices/soi3/soi3dest.c index 4f0195426..869d12514 100644 --- a/src/spicelib/devices/soi3/soi3dest.c +++ b/src/spicelib/devices/soi3/soi3dest.c @@ -35,7 +35,6 @@ SOI3destroy(GENmodel **inModel) SOI3instance *inst = mod->SOI3instances; while (inst) { SOI3instance *next_inst = inst->SOI3nextInstance; - /* FREE(inst->SOI3sens); */ FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/vbic/vbicdel.c b/src/spicelib/devices/vbic/vbicdel.c index 35fd4e64d..4143a629f 100644 --- a/src/spicelib/devices/vbic/vbicdel.c +++ b/src/spicelib/devices/vbic/vbicdel.c @@ -19,6 +19,7 @@ Spice3 Implementation: 2003 Dietmar Warning DAnalyse GmbH int VBICdelete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + VBICinstance *inst = (VBICinstance *) gen_inst; + FREE(inst->VBICsens); return OK; } diff --git a/src/spicelib/devices/vbic/vbicdest.c b/src/spicelib/devices/vbic/vbicdest.c index b3d50045e..603da1a15 100644 --- a/src/spicelib/devices/vbic/vbicdest.c +++ b/src/spicelib/devices/vbic/vbicdest.c @@ -25,7 +25,6 @@ VBICdestroy(GENmodel **inModel) VBICinstance *inst = mod->VBICinstances; while (inst) { VBICinstance *next_inst = inst->VBICnextInstance; - FREE(inst->VBICsens); FREE(inst); inst = next_inst; } diff --git a/src/spicelib/devices/vsrc/vsrcdel.c b/src/spicelib/devices/vsrc/vsrcdel.c index 663dd1d69..376583797 100644 --- a/src/spicelib/devices/vsrc/vsrcdel.c +++ b/src/spicelib/devices/vsrc/vsrcdel.c @@ -12,6 +12,9 @@ Author: 1985 Thomas L. Quarles int VSRCdelete(GENinstance *gen_inst) { - NG_IGNORE(gen_inst); + VSRCinstance *inst = (VSRCinstance *) gen_inst; + + FREE(inst->VSRCcoeffs); + return OK; } diff --git a/src/spicelib/devices/vsrc/vsrcdest.c b/src/spicelib/devices/vsrc/vsrcdest.c index 308a85792..093b86940 100644 --- a/src/spicelib/devices/vsrc/vsrcdest.c +++ b/src/spicelib/devices/vsrc/vsrcdest.c @@ -18,7 +18,6 @@ VSRCdestroy(GENmodel **inModel) VSRCinstance *inst = mod->VSRCinstances; while (inst) { VSRCinstance *next_inst = inst->VSRCnextInstance; - FREE(inst->VSRCcoeffs); FREE(inst); inst = next_inst; }