Index: src/ch/charvect.h =================================================================== diff -u -N -rcdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e -rebabad67cdda34ed4e36ab794e10d0ade8124bf3 --- src/ch/charvect.h (.../charvect.h) (revision cdf6a22ddf857f56ce2e27e26d8cd6f0b8034b2e) +++ src/ch/charvect.h (.../charvect.h) (revision ebabad67cdda34ed4e36ab794e10d0ade8124bf3) @@ -63,13 +63,21 @@ { size_type _Size=_tcslen(_Val)+1; PTSTR *ppsz=new PTSTR[_Count]; - for (size_type i=0;i<_Count;i++) + try { - ppsz[i]=new TCHAR[_Size]; - _tcscpy(ppsz[i], _Val); - } + for (size_type i=0;i<_Count;i++) + { + ppsz[i]=new TCHAR[_Size]; + _tcscpy(ppsz[i], _Val); + } - ((vector*)this)->insert(_Where, ppsz, ppsz+_Count); + ((vector*)this)->insert(_Where, ppsz, ppsz+_Count); + } + catch(...) + { + delete [] ppsz; + throw; + } delete [] ppsz; } else @@ -79,30 +87,44 @@ { size_type _Size=_tcslen(_Val)+1; PTSTR *ppsz=new PTSTR[_Count]; - for(size_type i=0;i<_Count;i++) + try { - ppsz[i]=new TCHAR[_Size]; - _tcscpy(ppsz[i], _Val); - } + for(size_type i=0;i<_Count;i++) + { + ppsz[i]=new TCHAR[_Size]; + _tcscpy(ppsz[i], _Val); + } - ((vector*)this)->insert(_Where, ppsz, ppsz+_Count); - delete [] ppsz; + ((vector*)this)->insert(_Where, ppsz, ppsz+_Count); + } + catch(...) + { + delete [] ppsz; + } }; template void insert(iterator _Where, _It _First, _It _Last, bool bCopy) { if (bCopy) { size_type _Cnt=_Last-_First; PTSTR *ppsz=new PTSTR[_Cnt]; - for (size_type i=0;i<_Cnt;i++) + try { - ppsz[i]=new TCHAR[_tcslen(*_First)+1]; - _tcscpy(ppsz[i], *_First); + for (size_type i=0;i<_Cnt;i++) + { + ppsz[i]=new TCHAR[_tcslen(*_First)+1]; + _tcscpy(ppsz[i], *_First); - _First++; - } + _First++; + } - ((vector*)this)->insert(_Where, ppsz, ppsz+_Cnt); + ((vector*)this)->insert(_Where, ppsz, ppsz+_Cnt); + } + catch(...) + { + delete [] ppsz; + throw; + } delete [] ppsz; } else