A bit further below, if rewrite != 0, then we may dereference these
points if they're not NULL. If that can happen, it would be a UAF.
Clear the pointers. Or perhaps the frees should be deferred to after
the check?
Noticed during code inspection, so I have no test case to offer.