Fixed #4523 (false positive: (error) Possible null pointer dereference)
This commit is contained in:
parent
3679a809dd
commit
509dd9a989
|
@ -857,6 +857,8 @@ void CheckNullPointer::nullPointerByDeRefAndChec()
|
|||
}
|
||||
back = back->previous();
|
||||
}
|
||||
} else if (Token::Match(tok1->tokAt(-4), "%varid% = ( * %varid% )", varid)) {
|
||||
reassign = true;
|
||||
}
|
||||
|
||||
if (reassign) {
|
||||
|
|
|
@ -695,6 +695,12 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(struct ABC *abc) {\n" // #4523
|
||||
" abc = (*abc).next;\n"
|
||||
" if (abc) { }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int f(Item *item) {\n"
|
||||
" x = item ? ab(item->x) : 0;\n"
|
||||
" if (item) { }\n"
|
||||
|
|
Loading…
Reference in New Issue