Illustration of "kickout flashing" and proper wall flashing.

From Roofing Installation Manual-Monier Tile, Inc.