diff --git a/lib/executionpath.cpp b/lib/executionpath.cpp index 120a29d40..8b9f35cae 100644 --- a/lib/executionpath.cpp +++ b/lib/executionpath.cpp @@ -241,9 +241,10 @@ void ExecutionPath::checkScope(const Token *tok, std::list &che // it is not certain that a for/while will be executed: for (std::list::iterator it = checks.begin(); it != checks.end();) { - if ((*it)->numberOfIf > 0) + if ((*it)->numberOfIf > 0) { + delete *it; checks.erase(it++); - else + } else ++it; }