From 27053b877f13934b79c8385062c2297fd402ac7c Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sun, 24 Jul 2016 18:02:17 +0200 Subject: [PATCH] devices/asrc, remove memory leak --- src/spicelib/devices/asrc/asrcdest.c | 4 ++++ src/spicelib/devices/asrc/asrcset.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/spicelib/devices/asrc/asrcdest.c b/src/spicelib/devices/asrc/asrcdest.c index 830fbb33d..4696106d5 100644 --- a/src/spicelib/devices/asrc/asrcdest.c +++ b/src/spicelib/devices/asrc/asrcdest.c @@ -30,5 +30,9 @@ ASRCdestroy(GENmodel **inModel) mod = next_mod; } + FREE(asrc_vals); + FREE(asrc_derivs); + asrc_nvals = 0; + *inModel = NULL; } diff --git a/src/spicelib/devices/asrc/asrcset.c b/src/spicelib/devices/asrc/asrcset.c index 8ff3b122b..cea053be5 100644 --- a/src/spicelib/devices/asrc/asrcset.c +++ b/src/spicelib/devices/asrc/asrcset.c @@ -127,11 +127,15 @@ ASRCunsetup(GENmodel *inModel, CKTcircuit *ckt) ASRCinstance *here; for (; model; model = model->ASRCnextModel) - for (here = model->ASRCinstances; here; here = here->ASRCnextInstance) + for (here = model->ASRCinstances; here; here = here->ASRCnextInstance) { if (here->ASRCbranch) { CKTdltNNum(ckt, here->ASRCbranch); here->ASRCbranch = 0; } + FREE(here->ASRCposptr); + FREE(here->ASRCvars); + FREE(here->ASRCacValues); + } return OK; }