Flashing is used to prevent water from seeping into vulnerable areas of the roof, such as joints and transitions.