]> git.sesse.net Git - ffmpeg/commitdiff
avformat/samidec: Deallocate hdr_buf
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 22 Feb 2021 19:44:36 +0000 (20:44 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 14 Mar 2021 22:29:51 +0000 (23:29 +0100)
Fixes: memleak
Fixes: 30841/clusterfuzz-testcase-minimized-ffmpeg_dem_SAMI_fuzzer-4521799196999680
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/samidec.c

index cf5076c7b817145483ea3e0776be56ef030f7bd4..d84f56ce6fae99546a489e61518ae959d934fe25 100644 (file)
@@ -89,6 +89,7 @@ static int sami_read_header(AVFormatContext *s)
             sub = ff_subtitles_queue_insert(&sami->q, buf.str, buf.len, !is_sync);
             if (!sub) {
                 res = AVERROR(ENOMEM);
+                av_bprint_finalize(&hdr_buf, NULL);
                 goto end;
             }
             if (is_sync) {
@@ -97,6 +98,7 @@ static int sami_read_header(AVFormatContext *s)
                 sub->pts      = p ? strtol(p, NULL, 10) : 0;
                 if (sub->pts <= INT64_MIN/2 || sub->pts >= INT64_MAX/2) {
                     res = AVERROR_PATCHWELCOME;
+                    av_bprint_finalize(&hdr_buf, NULL);
                     goto end;
                 }