Density inhomogeneities in heavy-ion collisions around the critical point