From 67b2ddbad51e716131f128402e28e842bd8538cf Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 2 Jun 2023 19:44:34 +0200 Subject: [PATCH] CIDER: Plug some memory leaks by adding to TWOdestroy() --- src/ciderlib/twod/twodest.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ciderlib/twod/twodest.c b/src/ciderlib/twod/twodest.c index d51297f93..147f5072b 100644 --- a/src/ciderlib/twod/twodest.c +++ b/src/ciderlib/twod/twodest.c @@ -66,9 +66,22 @@ TWOdestroy(TWOdevice *pDevice) FREE( pElem ); } FREE( pDevice->elements ); + for (int xIndex = 1; xIndex < pDevice->numXNodes; xIndex++) { + FREE(pDevice->elemArray[xIndex]); + } FREE( pDevice->elemArray ); } + if (pDevice->pMaterials) { + TWOmaterial* pMtmp = pDevice->pMaterials; + while (pMtmp) { + TWOmaterial* pMtmpnext = pMtmp->next; + FREE(pMtmp); + pMtmp = pMtmpnext; + } + } + + /* destroy the contacts & channels */ /* NOT IMPLEMENTED */