Fixed #3038 (False Positive - memory leak)
This commit is contained in:
parent
047984ea89
commit
6d9463139d
|
@ -848,6 +848,8 @@ const char * CheckMemoryLeakInFunction::call_func(const Token *tok, std::list<co
|
|||
return ret;
|
||||
}
|
||||
}
|
||||
if (varid > 0 && Token::Match(tok, "[(,] %varid% . %var% [,)]", varid))
|
||||
return "use";
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -487,6 +487,7 @@ private:
|
|||
ASSERT_EQUALS(";;use;;", getcode("char *s; x = {1,s};", "s"));
|
||||
ASSERT_EQUALS(";{};;alloc;;use;", getcode("struct Foo { }; Foo *p; p = malloc(10); const Foo *q; q = p;", "p"));
|
||||
ASSERT_EQUALS(";;alloc;use;", getcode("Fred *fred; p.setFred(fred = new Fred);", "fred"));
|
||||
ASSERT_EQUALS(";;use;", getcode("struct AB *ab; f(ab->a);", "ab"));
|
||||
|
||||
// non-use..
|
||||
ASSERT_EQUALS(";;", getcode("char *s; s = s + 1;", "s"));
|
||||
|
|
Loading…
Reference in New Issue