]> git.sesse.net Git - ffmpeg/commitdiff
avformat/au: cleanup on EOF return in au_read_annotation()
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 5 Nov 2020 19:23:54 +0000 (20:23 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 10 Nov 2020 15:37:37 +0000 (16:37 +0100)
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>
libavformat/au.c

index b4eb4f8477ae5faba3d2e7e830c55aed63aed2ba..4f2b81119fb022b169e7b4951796d1e1e1dbc2bb 100644 (file)
@@ -84,8 +84,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: