mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-26 01:02:33 +00:00
avformat/ffmetadec: finalize AVBPrint on errors
Fixes: memleak Fixes: 26450/clusterfuzz-testcase-minimized-ffmpeg_dem_FFMETADATA_fuzzer-6249850443923456 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
2beb7f43f6
commit
a927128617
@ -185,7 +185,7 @@ static int read_header(AVFormatContext *s)
|
||||
AVStream *st = avformat_new_stream(s, NULL);
|
||||
|
||||
if (!st)
|
||||
return AVERROR(ENOMEM);
|
||||
goto nomem;
|
||||
|
||||
st->codecpar->codec_type = AVMEDIA_TYPE_DATA;
|
||||
st->codecpar->codec_id = AV_CODEC_ID_FFMETADATA;
|
||||
@ -195,7 +195,7 @@ static int read_header(AVFormatContext *s)
|
||||
AVChapter *ch = read_chapter(s);
|
||||
|
||||
if (!ch)
|
||||
return AVERROR(ENOMEM);
|
||||
goto nomem;
|
||||
|
||||
m = &ch->metadata;
|
||||
} else
|
||||
@ -211,6 +211,10 @@ static int read_header(AVFormatContext *s)
|
||||
AV_TIME_BASE_Q);
|
||||
|
||||
return 0;
|
||||
nomem:
|
||||
av_bprint_finalize(&bp, NULL);
|
||||
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
static int read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
|
Loading…
Reference in New Issue
Block a user