Anisotropy of interfacial segregation: grain boundaries and free surfaces