InvalidPtrChecker - don't dereference a dyn_cast<> - use cast<> instead.

Avoid dereferencing a nullptr returned by dyn_cast<>, by using cast<> instead which asserts that the cast is valid.
This commit is contained in:
Simon Pilgrim 2021-10-20 18:05:46 +01:00
parent 310736e098
commit 7562f3df89
1 changed files with 1 additions and 1 deletions

View File

@ -146,7 +146,7 @@ void InvalidPtrChecker::postPreviousReturnInvalidatingCall(
State = State->BindExpr(CE, LCtx, RetVal);
// Remember to this region.
const auto *SymRegOfRetVal = dyn_cast<SymbolicRegion>(RetVal.getAsRegion());
const auto *SymRegOfRetVal = cast<SymbolicRegion>(RetVal.getAsRegion());
const MemRegion *MR =
const_cast<MemRegion *>(SymRegOfRetVal->getBaseRegion());
State = State->set<PreviousCallResultMap>(FD, MR);