From a75aec4d7c20c86e7fb52f28f358ad09e0471608 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Tue, 20 Aug 2019 15:10:45 -0400 Subject: [PATCH] Finally realized the problem came from a quick addition of a TO-DO item that was never properly validated. Corrected the root of the problem, which was an attempt to deallocate memory that had never been allocated in the first place. --- calma/CalmaRdcl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/calma/CalmaRdcl.c b/calma/CalmaRdcl.c index 78de9986..e69bb386 100644 --- a/calma/CalmaRdcl.c +++ b/calma/CalmaRdcl.c @@ -405,18 +405,18 @@ calmaParseStructure(filename) */ if (CalmaFlattenUses && (!was_called) && (npaths < 10) && (nsrefs == 0)) { - /* To-do: If CDFLATGDS is already set, need to remove */ + /* If CDFLATGDS is already set, may need to remove */ /* existing planes and free memory. */ - if (cifReadCellDef->cd_flags & CDFLATGDS) + if ((cifReadCellDef->cd_client != (ClientData)CLIENTDEFAULT) && + (cifReadCellDef->cd_flags & CDFLATGDS)) { Plane **cifplanes = (Plane **)cifReadCellDef->cd_client; int pNum; for (pNum = 0; pNum < MAXCIFRLAYERS; pNum++) { - if ((cifReadCellDef->cd_client != (ClientData)CLIENTDEFAULT) && - (cifplanes[pNum] != NULL)) + if (cifplanes[pNum] != NULL) { DBFreePaintPlane(cifplanes[pNum]); TiFreePlane(cifplanes[pNum]);