From c11613d1f7543ff19d7fe6f0baa17f628e77f8ab Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 21 Jul 2023 00:13:49 +0200 Subject: [PATCH] Fix some memory leaks (Patch provided by Brian Taylor) --- src/ciderlib/twod/twodest.c | 6 ++++++ src/ciderlib/twod/twosolve.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/ciderlib/twod/twodest.c b/src/ciderlib/twod/twodest.c index 537adc51d..71643ffd1 100644 --- a/src/ciderlib/twod/twodest.c +++ b/src/ciderlib/twod/twodest.c @@ -39,6 +39,9 @@ TWOdestroy(TWOdevice *pDevice) #else SMPdestroy (pDevice->matrix) ; #endif + if (pDevice->matrix) { + FREE(pDevice->matrix); + } break; case SLV_EQUIL: @@ -53,6 +56,9 @@ TWOdestroy(TWOdevice *pDevice) #else SMPdestroy (pDevice->matrix) ; #endif + if (pDevice->matrix) { + FREE(pDevice->matrix); + } break; case SLV_NONE: diff --git a/src/ciderlib/twod/twosolve.c b/src/ciderlib/twod/twosolve.c index fa09d4db6..8a509ef17 100644 --- a/src/ciderlib/twod/twosolve.c +++ b/src/ciderlib/twod/twosolve.c @@ -491,6 +491,9 @@ int TWOequilSolve(TWOdevice *pDevice) #else SMPdestroy (pDevice->matrix) ; #endif + if (pDevice->matrix) { + FREE(pDevice->matrix); + } /* FALLTHROUGH */ case SLV_NONE: { @@ -651,6 +654,9 @@ TWObiasSolve(TWOdevice *pDevice, int iterationLimit, BOOLEAN tranAnalysis, #else SMPdestroy (pDevice->matrix) ; #endif + if (pDevice->matrix) { + FREE(pDevice->matrix); + } /* FALLTHROUGH */ case SLV_NONE: