diff --git a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp index 7f154e8b666d..fa3f828157d9 100644 --- a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp +++ b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp @@ -117,6 +117,8 @@ FFmpegDataDecoder::InitDecoder() if (avcodec_open2(mCodecContext, codec, nullptr) < 0) { NS_WARNING("Couldn't initialise ffmpeg decoder"); + avcodec_close(mCodecContext); + av_freep(&mCodecContext); return NS_ERROR_FAILURE; }