Fixed #449 (false postive:: resource leak when using errno)

This commit is contained in:
Daniel Marjamäki 2009-10-18 13:17:05 +02:00
parent aca743c9ed
commit 58790eda82
2 changed files with 4 additions and 4 deletions

View File

@ -1716,8 +1716,7 @@ const Token *CheckMemoryLeakInFunction::findleak(const Token *tokens, bool all)
return result;
}
if ((result = Token::findmatch(tokens, "alloc ; if break|continue|return ;")) != NULL
&& Token::findmatch(tokens, "dealloc ; alloc ; if continue ;") == NULL)
if ((result = Token::findmatch(tokens, "alloc ; if return ;")) != NULL)
{
return result->tokAt(3);
}

View File

@ -580,8 +580,9 @@ private:
ASSERT_EQUALS(2, dofindleak("alloc;\n if assign;\n dealloc;"));
// loop..
ASSERT_EQUALS(1, dofindleak("; loop { alloc ; if break; dealloc ; }"));
ASSERT_EQUALS(1, dofindleak("; loop { alloc ; if continue; dealloc ; }"));
TODO_ASSERT_EQUALS(1, dofindleak("; loop { alloc ; if break; dealloc ; }"));
TODO_ASSERT_EQUALS(1, dofindleak("; loop { alloc ; if continue; dealloc ; }"));
ASSERT_EQUALS(-1, dofindleak("; loop { alloc ; if break; } dealloc ;"));
ASSERT_EQUALS(1, dofindleak("; loop alloc ;"));
ASSERT_EQUALS(1, dofindleak("; loop alloc ; dealloc ;"));