ffmpeg: fix memleak and corruption of AVSubtitle with multiple outputs