libavformat: Add a function for freeing an AVFormatContext