diff --git a/src/frontend/trannoise/1-f-code.c b/src/frontend/trannoise/1-f-code.c index 4af666ee5..9b55dc671 100644 --- a/src/frontend/trannoise/1-f-code.c +++ b/src/frontend/trannoise/1-f-code.c @@ -241,3 +241,12 @@ trrandom_state_init(int rndtype, double TS, double TD, double PARAM1, double PAR return this; } + +void +trnoise_state_free(struct trnoise_state *this) +{ + if (!this) + return; + tfree(this->oneof); + tfree(this); +} diff --git a/src/spicelib/devices/vsrc/vsrcdel.c b/src/spicelib/devices/vsrc/vsrcdel.c index f6f658f68..3adb81709 100644 --- a/src/spicelib/devices/vsrc/vsrcdel.c +++ b/src/spicelib/devices/vsrc/vsrcdel.c @@ -16,10 +16,7 @@ VSRCdelete(GENinstance *gen_inst) VSRCinstance *inst = (VSRCinstance *) gen_inst; FREE(inst->VSRCcoeffs); - if (inst->VSRCtrnoise_state) { - FREE(inst->VSRCtrnoise_state->oneof); - FREE(inst->VSRCtrnoise_state); - } + trnoise_state_free(inst->VSRCtrnoise_state); FREE(inst->VSRCtrrandom_state); return OK;