Consider the case of oscillation pendulum.
When a pendulum moves from its mean position P to either of its extreme positions A or B, it rises through a height h on top of the mean level P. At this time, the K.E. of the bob changes fully into P.E. The K.E. becomes zero, and also the bob possesses only P.E. To retain its initial [position bob moves towards its mean position but by the time it reaches its mean position(P) all the P.E. gets converted into K.E and heat(due to air resistance). Due to it gains K.E. is is not able to stop at its means position so bob reaches position B. Again bob desires to reach its mean position but by the time is reaches point P its K.E. increases and it moves away from P. But this time it doesn't reaches point A, due to some energy gets converted into heat by air resistance.
Due to this air resistance bob does not oscillated forever. And hence their is no voilation of "law of conservation of energy".