pointers set to NULL after freeing memory