Free previously allocate PPS and ref_pic_sets.

This fixes a memory leak if a stream contains multiple PPS and SPS.