[FFmpeg-devel] [PATCH 7/9] avcodec/vlc: Cleanup on multi table alloc failure in ff_vlc_init_multi_from_lengths()

Michael Niedermayer michael at niedermayer.cc
Sat May 18 06:57:41 EEST 2024


Fixes: CID1544630 Resource leak

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/vlc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vlc.c b/libavcodec/vlc.c
index ee09d96fd61..f46ecbb55e9 100644
--- a/libavcodec/vlc.c
+++ b/libavcodec/vlc.c
@@ -529,7 +529,7 @@ int ff_vlc_init_multi_from_lengths(VLC *vlc, VLC_MULTI *multi, int nb_bits, int
 
     multi->table = av_malloc(sizeof(*multi->table) << nb_bits);
     if (!multi->table)
-        return AVERROR(ENOMEM);
+        goto fail;
 
     j = code = 0;
     for (int i = 0; i < nb_codes; i++, lens += lens_wrap) {
-- 
2.45.1



More information about the ffmpeg-devel mailing list