Skip to content

Commit 22a5881

Browse files
committed
Uninitialized variables: Experimental checking for passing const pointer to partially initialized struct to function. Ticket: cppcheck-opensource#5586
1 parent 8de4246 commit 22a5881

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎lib/checkuninitvar.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,12 @@ bool CheckUninitVar::isMemberVariableUsage(const Token *tok, bool isPointer, boo
18821882
else if (!isPointer && Token::Match(tok->previous(), "[(,] %var% [,)]") && isVariableUsage(tok, isPointer, alloc, _tokenizer->isCPP()))
18831883
return true;
18841884

1885+
else if (_settings->experimental &&
1886+
!isPointer &&
1887+
Token::Match(tok->tokAt(-2), "[(,] & %var% [,)]") &&
1888+
isVariableUsage(tok, isPointer, alloc, _tokenizer->isCPP()))
1889+
return true;
1890+
18851891
return false;
18861892
}
18871893

0 commit comments

Comments
 (0)