Protect against dangling pointer bugs by setting the pointer to NULL after it is freed.