Null pointer: Added todo test case to better handle dereference in condition
This commit is contained in:
parent
08f27564fa
commit
493cfa5df2
|
@ -429,6 +429,13 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (error) Possible null pointer dereference: p - otherwise it is redundant to check if p is null at line 4\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:3]: (error) Possible null pointer dereference: p - otherwise it is redundant to check if p is null at line 4\n", errout.str());
|
||||||
|
|
||||||
|
check("void foo(char *p)\n"
|
||||||
|
"{\n"
|
||||||
|
" if (*p == 0) { }\n"
|
||||||
|
" if (!p) { }\n"
|
||||||
|
"}\n");
|
||||||
|
TODO_ASSERT_EQUALS("[test.cpp:3]: (error) Possible null pointer dereference: p - otherwise it is redundant to check if p is null at line 4\n", "", errout.str());
|
||||||
|
|
||||||
// no error
|
// no error
|
||||||
check("void foo()\n"
|
check("void foo()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue