Fix this code to avoid decrementing an iterator past the beginning

of a std::vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109597 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2010-07-28 17:15:36 +00:00
parent 33591af872
commit 6d3b922670

View File

@ -58,13 +58,10 @@ namespace PIC16CC {
ESNames() {}
public:
~ESNames() {
std::vector<char*>::iterator it = stk.end();
it--;
while(stk.end() != stk.begin())
while (!stk.empty())
{
char* p = *it;
char* p = stk.back();
delete [] p;
it--;
stk.pop_back();
}
}