ffmpeg: Use av_freep(), avoid leaving stale pointers in memory