Eric Sesterhenn: Fixed #1131 (descriptor leak false positive)
This commit is contained in:
parent
5b87a51aa5
commit
b4b63789fc
|
@ -847,7 +847,8 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Token::Match(tok->previous(), "[;{})=] %var%"))
|
if (Token::Match(tok->previous(), "[;{})=] %var%") ||
|
||||||
|
Token::Match(tok->previous(), "|= %var%"))
|
||||||
{
|
{
|
||||||
AllocType dealloc = getDeallocationType(tok, varid);
|
AllocType dealloc = getDeallocationType(tok, varid);
|
||||||
if (dealloc != No)
|
if (dealloc != No)
|
||||||
|
|
|
@ -493,6 +493,8 @@ private:
|
||||||
// open/close
|
// open/close
|
||||||
ASSERT_EQUALS(";;alloc;if(var){dealloc;}", getcode("int f; f=open(); if(f>=0)close(f);", "f"));
|
ASSERT_EQUALS(";;alloc;if(var){dealloc;}", getcode("int f; f=open(); if(f>=0)close(f);", "f"));
|
||||||
ASSERT_EQUALS(";;alloc;ifv{;}", getcode("int f; f=open(); if(f!=-1 || x);", "f"));
|
ASSERT_EQUALS(";;alloc;ifv{;}", getcode("int f; f=open(); if(f!=-1 || x);", "f"));
|
||||||
|
|
||||||
|
ASSERT_EQUALS(";;dealloc;", getcode("int f; e |= fclose(f);", "f"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue