mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/jvdec: fix memleak when read_header failed
Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
This commit is contained in:
parent
da0c0c7247
commit
6f84c1e907
|
@ -113,9 +113,10 @@ static int read_header(AVFormatContext *s)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
jv->frames = av_malloc(ast->nb_index_entries * sizeof(JVFrame));
|
jv->frames = av_malloc(ast->nb_index_entries * sizeof(JVFrame));
|
||||||
if (!jv->frames)
|
if (!jv->frames) {
|
||||||
|
av_freep(&ast->index_entries);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
offset = 0x68 + ast->nb_index_entries * 16;
|
offset = 0x68 + ast->nb_index_entries * 16;
|
||||||
for (i = 0; i < ast->nb_index_entries; i++) {
|
for (i = 0; i < ast->nb_index_entries; i++) {
|
||||||
AVIndexEntry *e = ast->index_entries + i;
|
AVIndexEntry *e = ast->index_entries + i;
|
||||||
|
@ -137,6 +138,8 @@ static int read_header(AVFormatContext *s)
|
||||||
- jvf->palette_size < 0) {
|
- jvf->palette_size < 0) {
|
||||||
if (s->error_recognition & AV_EF_EXPLODE) {
|
if (s->error_recognition & AV_EF_EXPLODE) {
|
||||||
read_close(s);
|
read_close(s);
|
||||||
|
av_freep(&jv->frames);
|
||||||
|
av_freep(&ast->index_entries);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
jvf->audio_size =
|
jvf->audio_size =
|
||||||
|
|
Loading…
Reference in New Issue