Skip to content

Commit a6e901e

Browse files
Update checkmemoryleak.cpp
1 parent 1def032 commit a6e901e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/checkmemoryleak.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ void CheckMemoryLeakStructMember::checkStructVariable(const Variable* const vari
947947
}
948948

949949
// Returning from function..
950-
else if ((tok3->scope()->type != ScopeType::eLambda || tok3->scope() == variable->scope()) && tok3->str() == "return") {
950+
else if (((tok3->scope()->type != ScopeType::eLambda && tok3->scope()->type != ScopeType::eSwitch) || tok3->scope() == variable->scope()) && tok3->str() == "return") {
951951
// Returning from function without deallocating struct member?
952952
if (!Token::Match(tok3, "return %varid% ;", structid) &&
953953
!Token::Match(tok3, "return & %varid%", structid) &&

0 commit comments

Comments
 (0)