Hi, I found a false negative regarding the rule autoVariables.
autoVariables
Cppcheck misses an escaping local address when it passes through a pointer temporary.
void f(int **out) { int local = 1; int *temporary = &local; *out = temporary; }
Cppcheck does not report autoVariables. Replacing the last two statements with *out = &local; produces the warning.
*out = &local;
Cppcheck should report that the address of the local variable is assigned through the output parameter in both forms.
The issue was reproduced with:
cppcheck --output-format=xmlv2 --enable=all local_address.cpp
Version: 2.21.0
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/15073
Log in to post a comment.
Hi, I found a false negative regarding the rule
autoVariables.Cppcheck misses an escaping local address when it passes through a pointer temporary.
Actual result
Cppcheck does not report
autoVariables. Replacing the last two statements with*out = &local;produces the warning.Expected result
Cppcheck should report that the address of the local variable is assigned through the output parameter in both forms.
Verification
The issue was reproduced with:
Version: 2.21.0
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/15073