aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-11-05 20:23:54 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:53:29 +0200
commit5d0d405d6c34ff83c19c387802e540bc890c699a (patch)
tree2cef0553b79dee631ef95e615d3f993ba6090854
parentf9cde79ca7f984e47e29d414cdc58a83793f55eb (diff)
downloadffmpeg-5d0d405d6c34ff83c19c387802e540bc890c699a.tar.gz
avformat/au: cleanup on EOF return in au_read_annotation()
Fixes: memleak Fixes: 26841/clusterfuzz-testcase-minimized-ffmpeg_dem_AU_fuzzer-5174166309044224 Regression since: e680d50eb4feddafb2d8575b21fc5fc8764f4801 Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit d16974c3dd3a05900aa080ea0729284aea358d10) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/au.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/au.c b/libavformat/au.c
index a414292894..55c73015e8 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -86,8 +86,11 @@ static int au_read_annotation(AVFormatContext *s, int size)
av_bprint_init(&bprint, 64, AV_BPRINT_SIZE_UNLIMITED);
while (size-- > 0) {
- if (avio_feof(pb))
+ if (avio_feof(pb)) {
+ av_bprint_finalize(&bprint, NULL);
+ av_freep(&key);
return AVERROR_EOF;
+ }
c = avio_r8(pb);
switch(state) {
case PARSE_KEY: