[FFmpeg-cvslog] avformat/mov: don't reallocate extradata when converting dvdsub palette

Marth64 git at videolan.org
Sat Dec 14 06:43:20 EET 2024


ffmpeg | branch: master | Marth64 <marth64 at proxyid.net> | Tue Dec 10 18:04:25 2024 -0600| [8291aedf1abfdbc48c9aa18a7929a464c186782a] | committer: Marth64

avformat/mov: don't reallocate extradata when converting dvdsub palette

After introduction of ff_dvdclut_palette_extradata_cat() to convert
DVD subtitle palettes from YUV to RGB, a leak is introduced because
of the call to ff_alloc_extradata(). This is not necessary, instead
we should free the extradata because ff_bprint_to_codecpar_extradata()
will finalize the bprint'ed string to the codecpar and set the length.

Fixes leak introduced in 3b0e6c0eccd7d61eb089370fc5f2196c2b30336f.

Signed-off-by: Marth64 <marth64 at proxyid.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8291aedf1abfdbc48c9aa18a7929a464c186782a
---

 libavformat/mov.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 3820983a5d..26f1bf7e1b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -10602,9 +10602,8 @@ static int mov_read_header(AVFormatContext *s)
                 if (err < 0)
                     return err;
 
-                err = ff_alloc_extradata(st->codecpar, FF_DVDCLUT_EXTRADATA_SIZE);
-                if (err < 0)
-                    return err;
+                av_freep(&st->codecpar->extradata);
+                st->codecpar->extradata_size = 0;
 
                 err = ff_dvdclut_palette_extradata_cat(dvdsub_clut, FF_DVDCLUT_CLUT_SIZE,
                                                        st->codecpar);



More information about the ffmpeg-cvslog mailing list