[FFmpeg-devel] [PATCH 4/5] avcodec/sunrast: fix leak in sunrast_decode_frame()

Michael Niedermayer michael at niedermayer.cc
Mon Jun 30 04:07:33 EEST 2025


On Sun, Jun 29, 2025 at 02:45:25PM +0800, Lidong Yan wrote:
> In sunrast_decode_frame(), we use av_malloc_array() allocates memory
> to ptr and ptr2. However if buf_end - buf < 1, this function returns
> error code without freeing this memory thus cause a leak. Add av_freep()
> before return.
> 
> Signed-off-by: Lidong Yan <502024330056 at smail.nju.edu.cn>
> ---
>  libavcodec/sunrast.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

will apply

might be nice to factor this so its freed in a common place

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250630/e99d846b/attachment.sig>


More information about the ffmpeg-devel mailing list