Commit 59697e42 authored by Steven Liu's avatar Steven Liu

avformat/rl2: fix memleak when read end of file

Signed-off-by: 's avatarSteven Liu <lq@chinaffmpeg.org>
parent 7a200089
...@@ -171,18 +171,24 @@ static av_cold int rl2_read_header(AVFormatContext *s) ...@@ -171,18 +171,24 @@ static av_cold int rl2_read_header(AVFormatContext *s)
/** read offset and size tables */ /** read offset and size tables */
for(i=0; i < frame_count;i++) { for(i=0; i < frame_count;i++) {
if (avio_feof(pb)) if (avio_feof(pb)) {
return AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;
goto end;
}
chunk_size[i] = avio_rl32(pb); chunk_size[i] = avio_rl32(pb);
} }
for(i=0; i < frame_count;i++) { for(i=0; i < frame_count;i++) {
if (avio_feof(pb)) if (avio_feof(pb)) {
return AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;
goto end;
}
chunk_offset[i] = avio_rl32(pb); chunk_offset[i] = avio_rl32(pb);
} }
for(i=0; i < frame_count;i++) { for(i=0; i < frame_count;i++) {
if (avio_feof(pb)) if (avio_feof(pb)) {
return AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;
goto end;
}
audio_size[i] = avio_rl32(pb) & 0xFFFF; audio_size[i] = avio_rl32(pb) & 0xFFFF;
} }
...@@ -203,7 +209,7 @@ static av_cold int rl2_read_header(AVFormatContext *s) ...@@ -203,7 +209,7 @@ static av_cold int rl2_read_header(AVFormatContext *s)
++video_frame_counter; ++video_frame_counter;
} }
end:
av_free(chunk_size); av_free(chunk_size);
av_free(audio_size); av_free(audio_size);
av_free(chunk_offset); av_free(chunk_offset);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment