Fix a double-free in ffmpeg decoding/encoding

There was an edge-case where ffmpeg buffers were being freed twice, causing
crashes.  This doesn't fix the cause of the edge-case, but it does seem to
avoid the crashes.