class TyParList {
public:
- TyParList(DWORD a, BinStr* b, LPCUTF8 n, TyParList* nx = NULL)
+ TyParList(DWORD a, BinStr* b, LPCUTF8 n, TyParList* nx = NULL)
{
bound = (b == NULL) ? new BinStr() : b;
bound->appendInt32(0); // zero terminator
- attrs = a; name = n; next = nx;
- };
- ~TyParList()
- {
- if(bound) delete bound;
- if (next) delete next;
- };
+ attrs = a; name = n; next = nx;
+ };
+ ~TyParList()
+ {
+ if( bound) delete bound;
+
+ // To avoid excessive stack usage (especially in debug builds), we break the next chain
+ // and delete as we traverse the link list
+ TyParList *pCur = next;
+ while (pCur != NULL)
+ {
+ TyParList *pTmp = pCur->next;
+ pCur->next = NULL;
+ delete pCur;
+ pCur = pTmp;
+ }
+ };
int Count()
{
TyParList* tp = this;
TyParList* Next() { return next; };
BinStr* Bound() { return bound; };
private:
- BinStr* bound;
+ BinStr* bound;
LPCUTF8 name;
TyParList* next;
DWORD attrs;