I have a perfectly valid piece of C code, stripped down from a real-world example which gets a false positive nullPointer warning from cppcheck 2.1. File t.c is attached.
The bug is: although cppcheck realizes that the first term in the boolean expression is always true (and hence could ignore the 2nd term), it still checks the 2nd term and finds a null pointer dereference.
I'd appreciate if someone could verify this and file a bug report for me in Trac.
Thanks,
-Jochen
I have a perfectly valid piece of C code, stripped down from a real-world example which gets a false positive
nullPointer
warning from cppcheck 2.1. Filet.c
is attached.The
cppcheck
result is this:The bug is: although
cppcheck
realizes that the first term in the boolean expression is always true (and hence could ignore the 2nd term), it still checks the 2nd term and finds a null pointer dereference.I'd appreciate if someone could verify this and file a bug report for me in Trac.
Thanks,
-Jochen
Thanks! I can reproduce with git head. I created ticket https://trac.cppcheck.net/ticket/9807