From f3f7df33de02410699895b5f9a77901b550578cd Mon Sep 17 00:00:00 2001 From: nealsid Date: Thu, 30 Jul 2009 22:53:09 +0000 Subject: Fix an INVALIDATE_ITERATOR defect reported by Coverity. std::vector::erase() invalidates the iterator, so we need to advance the iterator by using the return value of erase(). R=nealsid A=wtc git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@370 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/client/windows/handler/exception_handler.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/client/windows/handler/exception_handler.cc') diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc index 48900273..be9e5eb2 100644 --- a/src/client/windows/handler/exception_handler.cc +++ b/src/client/windows/handler/exception_handler.cc @@ -249,12 +249,12 @@ ExceptionHandler::~ExceptionHandler() { // TODO(mmentovai): use advapi32!ReportEvent to log the warning to the // system's application event log. fprintf(stderr, "warning: removing Breakpad handler out of order\n"); - for (vector::iterator iterator = - handler_stack_->begin(); - iterator != handler_stack_->end(); - ++iterator) { + vector::iterator iterator = handler_stack_->begin(); + while (iterator != handler_stack_->end()) { if (*iterator == this) { - handler_stack_->erase(iterator); + iterator = handler_stack_->erase(iterator); + } else { + ++iterator; } } } -- cgit v1.2.1