diff options
author | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2017-11-12 21:01:31 +0100 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-11-12 12:01:31 -0800 |
commit | 56ec8cb6dcbb0e7a844f2f3e37b646bb57a737db (patch) | |
tree | 32cf9e3d87ee5f5d68faee3ca1d318442947699a /src | |
parent | 05a78fad0cc7a117d9e884a5f3bc1d5799320cac (diff) | |
download | coreclr-56ec8cb6dcbb0e7a844f2f3e37b646bb57a737db.tar.gz coreclr-56ec8cb6dcbb0e7a844f2f3e37b646bb57a737db.tar.bz2 coreclr-56ec8cb6dcbb0e7a844f2f3e37b646bb57a737db.zip |
Port https://github.com/dotnet/coreclr/pull/13148 to master (#14999)
Diffstat (limited to 'src')
-rw-r--r-- | src/ilasm/typar.hpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/ilasm/typar.hpp b/src/ilasm/typar.hpp index 143a4a2da3..146128e30a 100644 --- a/src/ilasm/typar.hpp +++ b/src/ilasm/typar.hpp @@ -51,17 +51,27 @@ private: 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; @@ -154,7 +164,7 @@ public: TyParList* Next() { return next; }; BinStr* Bound() { return bound; }; private: - BinStr* bound; + BinStr* bound; LPCUTF8 name; TyParList* next; DWORD attrs; |