[FFmpeg-cvslog] avcodec/webp: Return directly when creating Huff table fails

Andreas Rheinhardt git at videolan.org
Tue Oct 27 12:51:20 EET 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Thu Oct 22 16:03:41 2020 +0200| [548f1a3fa479836d60d85d02708db79c6345acea] | committer: Andreas Rheinhardt

avcodec/webp: Return directly when creating Huff table fails

Neither the auxiliary VLC table nor the code_lengths array need to be
freed if creating the auxiliary VLC table fails.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

 libavcodec/webp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index 6b53a7f17c..549d125dcc 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -324,7 +324,7 @@ static int read_huffman_code_normal(WebPContext *s, HuffReader *hc,
                                     int alphabet_size)
 {
     HuffReader code_len_hc = { { 0 }, 0, 0, { 0 } };
-    uint8_t *code_lengths = NULL;
+    uint8_t *code_lengths;
     uint8_t code_length_code_lengths[NUM_CODE_LENGTH_CODES] = { 0 };
     int i, symbol, max_symbol, prev_code_len, ret;
     int num_codes = 4 + get_bits(&s->gb, 4);
@@ -338,7 +338,7 @@ static int read_huffman_code_normal(WebPContext *s, HuffReader *hc,
     ret = huff_reader_build_canonical(&code_len_hc, code_length_code_lengths,
                                       NUM_CODE_LENGTH_CODES);
     if (ret < 0)
-        goto finish;
+        return ret;
 
     code_lengths = av_mallocz(alphabet_size);
     if (!code_lengths) {



More information about the ffmpeg-cvslog mailing list