Fixed #449 (false postive:: resource leak when using errno)
This commit is contained in:
parent
aca743c9ed
commit
58790eda82
|
@ -1716,8 +1716,7 @@ const Token *CheckMemoryLeakInFunction::findleak(const Token *tokens, bool all)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((result = Token::findmatch(tokens, "alloc ; if break|continue|return ;")) != NULL
|
if ((result = Token::findmatch(tokens, "alloc ; if return ;")) != NULL)
|
||||||
&& Token::findmatch(tokens, "dealloc ; alloc ; if continue ;") == NULL)
|
|
||||||
{
|
{
|
||||||
return result->tokAt(3);
|
return result->tokAt(3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -580,8 +580,9 @@ private:
|
||||||
ASSERT_EQUALS(2, dofindleak("alloc;\n if assign;\n dealloc;"));
|
ASSERT_EQUALS(2, dofindleak("alloc;\n if assign;\n dealloc;"));
|
||||||
|
|
||||||
// loop..
|
// loop..
|
||||||
ASSERT_EQUALS(1, dofindleak("; loop { alloc ; if break; dealloc ; }"));
|
TODO_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 continue; dealloc ; }"));
|
||||||
|
ASSERT_EQUALS(-1, dofindleak("; loop { alloc ; if break; } dealloc ;"));
|
||||||
ASSERT_EQUALS(1, dofindleak("; loop alloc ;"));
|
ASSERT_EQUALS(1, dofindleak("; loop alloc ;"));
|
||||||
ASSERT_EQUALS(1, dofindleak("; loop alloc ; dealloc ;"));
|
ASSERT_EQUALS(1, dofindleak("; loop alloc ; dealloc ;"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue