On the porosity of barrier layers