Fix libav memory leak