Here are the fixes to the other memory leaks I found. All of them is the
result of the use of pointer to pointers construct which got the coder to
shoot himself in the foot.
To clean up such constructs, deallocs in two levels is always required. A
simple 'delete [] ptr2ptr;' is not enough.
But all of you already know that and these bugs are probably cut'n'paste
related :)
Erik Rydgren
Mandarinen systems AB
Sweden
----------------------------------------------------------------------------
-------------------------
ElemStack::~ElemStack()
{
//
// Start working from the bottom of the stack and clear it out as we
// go up. Once we hit an uninitialized one, we can break out.
//
for (unsigned int stackInd = 0; stackInd < fStackCapacity; stackInd++)
{
// If this entry has been set, then lets clean it up
if (!fStack[stackInd])
break;
// Delete the row for this entry, then delete the row structure
>> BEGIN FIX
for (unsigned int childIndex = 0; childIndex <
fStack[stackInd]->fChildCount; ++childIndex)
delete fStack[stackInd]->fChildren[childIndex];
>> END FIX
delete [] fStack[stackInd]->fChildren;
delete [] fStack[stackInd]->fMap;
delete fStack[stackInd];
}
// Delete the stack array itself now
delete [] fStack;
}
----------------------------------------------------------------------------
-------------------------
DFAContentModel::~DFAContentModel()
{
//
// Clean up all the stuff that is not just temporary representation
// data that was cleaned up after building the DFA.
//
delete [] fFinalStateFlags;
unsigned index;
for (index = 0; index < fTransTableSize; index++)
delete [] fTransTable[index];
delete [] fTransTable;
>> BEGIN FIX
for (index = 0; index < fLeafCount; index++)
delete fElemMap[index];
>> END FIX
delete [] fElemMap;
delete [] fElemMapType;
delete [] fLeafListType;
}
----------------------------------------------------------------------------
-------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]