summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2019-10-10 10:07:52 +0800
committerSteven Liu <lq@chinaffmpeg.org>2019-10-28 14:26:11 +0800
commit59697e42e1b7535863794d301fbdb75e119f4683 (patch)
treedda644d445a113aa77557391064e8870665a7834
parent7a200089641b19b8cddbf844d9047be1d676cba8 (diff)
downloadffmpeg-streaming-59697e42e1b7535863794d301fbdb75e119f4683.zip
ffmpeg-streaming-59697e42e1b7535863794d301fbdb75e119f4683.tar.gz
avformat/rl2: fix memleak when read end of file
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
-rw-r--r--libavformat/rl2.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index d847d9a..0769696 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -171,18 +171,24 @@ static av_cold int rl2_read_header(AVFormatContext *s)
/** read offset and size tables */
for(i=0; i < frame_count;i++) {
- if (avio_feof(pb))
- return AVERROR_INVALIDDATA;
+ if (avio_feof(pb)) {
+ ret = AVERROR_INVALIDDATA;
+ goto end;
+ }
chunk_size[i] = avio_rl32(pb);
}
for(i=0; i < frame_count;i++) {
- if (avio_feof(pb))
- return AVERROR_INVALIDDATA;
+ if (avio_feof(pb)) {
+ ret = AVERROR_INVALIDDATA;
+ goto end;
+ }
chunk_offset[i] = avio_rl32(pb);
}
for(i=0; i < frame_count;i++) {
- if (avio_feof(pb))
- return AVERROR_INVALIDDATA;
+ if (avio_feof(pb)) {
+ ret = AVERROR_INVALIDDATA;
+ goto end;
+ }
audio_size[i] = avio_rl32(pb) & 0xFFFF;
}
@@ -203,7 +209,7 @@ static av_cold int rl2_read_header(AVFormatContext *s)
++video_frame_counter;
}
-
+end:
av_free(chunk_size);
av_free(audio_size);
av_free(chunk_offset);
OpenPOWER on IntegriCloud