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.
This commit is contained in:
Tim Edwards 2019-08-20 15:10:45 -04:00
parent d5b695fea0
commit a75aec4d7c
1 changed files with 4 additions and 4 deletions

View File

@ -405,18 +405,18 @@ calmaParseStructure(filename)
*/ */
if (CalmaFlattenUses && (!was_called) && (npaths < 10) && (nsrefs == 0)) 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. */ /* 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; Plane **cifplanes = (Plane **)cifReadCellDef->cd_client;
int pNum; int pNum;
for (pNum = 0; pNum < MAXCIFRLAYERS; pNum++) for (pNum = 0; pNum < MAXCIFRLAYERS; pNum++)
{ {
if ((cifReadCellDef->cd_client != (ClientData)CLIENTDEFAULT) && if (cifplanes[pNum] != NULL)
(cifplanes[pNum] != NULL))
{ {
DBFreePaintPlane(cifplanes[pNum]); DBFreePaintPlane(cifplanes[pNum]);
TiFreePlane(cifplanes[pNum]); TiFreePlane(cifplanes[pNum]);