Browse Source

avformat/rl2: fix memleak when read end of file

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
tags/n4.3
Steven Liu 6 years ago
parent
commit
59697e42e1
1 changed files with 13 additions and 7 deletions
  1. +13
    -7
      libavformat/rl2.c

+ 13
- 7
libavformat/rl2.c View File

@@ -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);


Loading…
Cancel
Save