We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1def032 commit a6e901eCopy full SHA for a6e901e
1 file changed
lib/checkmemoryleak.cpp
@@ -947,7 +947,7 @@ void CheckMemoryLeakStructMember::checkStructVariable(const Variable* const vari
947
}
948
949
// Returning from function..
950
- else if ((tok3->scope()->type != ScopeType::eLambda || tok3->scope() == variable->scope()) && tok3->str() == "return") {
+ else if (((tok3->scope()->type != ScopeType::eLambda && tok3->scope()->type != ScopeType::eSwitch) || tok3->scope() == variable->scope()) && tok3->str() == "return") {
951
// Returning from function without deallocating struct member?
952
if (!Token::Match(tok3, "return %varid% ;", structid) &&
953
!Token::Match(tok3, "return & %varid%", structid) &&
0 commit comments