[FFmpeg-devel] [PATCH 1/5] avcodec/utvideodec: fix leaks in decode_plane() and decode_plane10()
Lidong Yan
yldhome2d2 at gmail.com
Sun Jun 29 09:45:22 EEST 2025
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 at 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);
--
2.50.0.106.gf0135a9047.dirty
More information about the ffmpeg-devel
mailing list