On Sun, Jun 29, 2025 at 02:45:22PM +0800, Lidong Yan wrote: > In decode_plane() and decode_plane10(), both of these two functions use > build_buff() which allocates memory in vlc and multi. And both of them > forget to release vlc and multi when build_buff report a symbol to fill > slices with. Add cleanup label and goto cleanup first before return 0. > > Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> > --- > libavcodec/utvideodec.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c > index 4c0fa2ca67..f15d623462 100644 > --- a/libavcodec/utvideodec.c > +++ b/libavcodec/utvideodec.c > @@ -179,7 +179,7 @@ static int decode_plane10(UtvideoContext *c, int plane_no, > dest += stride; > } > } > - return 0; > + goto cleanup; > } > > send = 0; > @@ -216,6 +216,7 @@ static int decode_plane10(UtvideoContext *c, int plane_no, > "%d bits left after decoding slice\n", get_bits_left(&gb)); > } > > +cleanup: > ff_vlc_free(&vlc); > ff_vlc_free_multi(&multi); > > @@ -322,7 +323,7 @@ static int decode_plane(UtvideoContext *c, int plane_no, > dest += stride; > } > } > - return 0; > + goto cleanup; > } > > src += 256; > @@ -361,6 +362,7 @@ static int decode_plane(UtvideoContext *c, int plane_no, > "%d bits left after decoding slice\n", get_bits_left(&gb)); > } > > +cleanup: > ff_vlc_free(&vlc); > ff_vlc_free_multi(&multi); This is not correct build_huff() does not set these when fsym >= 0 your patch runs free() on random uninitialized variables before submitting memleak fixes, please verify that 1. there is actually a leak 2. your patch does not introduce a new anomaly thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Does the universe only have a finite lifespan? No, its going to go on forever, its just that you wont like living in it. -- Hiranya Peiri