#include <petscsys.h> PetscErrorCode PetscFree(void *memory)
It is safe to call PetscFree() on a NULL pointer.