Fixed false positive #5327: fclose as inner function call
This commit is contained in:
parent
c0e2adf723
commit
8788e58cbb
|
@ -931,7 +931,7 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
|
|||
}
|
||||
}
|
||||
|
||||
if (Token::Match(tok->previous(), "[;{})=|+-] ::| %var%")) {
|
||||
if (Token::Match(tok->previous(), "%op%|;|{|}|) ::| %var%") || (Token::Match(tok->previous(), "( ::| %var%") && (!rettail || rettail->str() != "loop"))) {
|
||||
if (Token::Match(tok, "%varid% ?", varid))
|
||||
tok = tok->tokAt(2);
|
||||
|
||||
|
|
|
@ -556,6 +556,7 @@ private:
|
|||
|
||||
ASSERT_EQUALS(";;dealloc;", getcode("int f; e |= fclose(f);", "f"));
|
||||
ASSERT_EQUALS(";;dealloc;", getcode("int f; e += fclose(f);", "f"));
|
||||
ASSERT_EQUALS(";;dealloc;", getcode("int f; foo(fclose(f));", "f"));
|
||||
|
||||
// fcloseall..
|
||||
ASSERT_EQUALS(";;alloc;;", getcode("char *s; s = malloc(10); fcloseall();", "s"));
|
||||
|
|
Loading…
Reference in New Issue