From 70523ac48d1ba2af7b8dd73c3b10c3cf03b4f0d6 Mon Sep 17 00:00:00 2001 From: Devon Kirk Date: Sat, 20 Jun 2026 19:11:44 -0400 Subject: [PATCH] decoder/ffmpeg: free AVIO buffer --- src/decoder/plugins/FfmpegIo.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/decoder/plugins/FfmpegIo.cxx b/src/decoder/plugins/FfmpegIo.cxx index 999a597586..0c92f91fc2 100644 --- a/src/decoder/plugins/FfmpegIo.cxx +++ b/src/decoder/plugins/FfmpegIo.cxx @@ -97,9 +97,10 @@ AvioStream::Open() false, this, _Read, nullptr, input.IsSeekable() ? _Seek : nullptr); - /* If avio_alloc_context() fails, who frees the buffer? The - libavformat API documentation does not specify this, it - only says that AVIOContext.buffer must be freed in the end, - however no AVIOContext exists in that failure code path. */ - return io != nullptr; + if (io == nullptr) { + av_free(buffer); + return false; + } + + return true; }