diff mbox series

[FFmpeg-devel,11/21] avformat/jvdec: Simplify cleanup after read_header failure

Message ID 20200322034756.29907-11-andreas.rheinhardt@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,01/21] avformat/nsvdec: Use av_packet_move_ref() for packet ownership transfer | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andreas Rheinhardt March 22, 2020, 3:47 a.m. UTC
by setting the FF_INPUTFORMAT_HEADER_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/jvdec.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index 551f8069e6..efa034c9ce 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -114,7 +114,6 @@  static int read_header(AVFormatContext *s)
 
     jv->frames = av_malloc(ast->nb_index_entries * sizeof(JVFrame));
     if (!jv->frames) {
-        av_freep(&ast->index_entries);
         return AVERROR(ENOMEM);
     }
     offset = 0x68 + ast->nb_index_entries * 16;
@@ -137,9 +136,6 @@  static int read_header(AVFormatContext *s)
                     - jvf->video_size
                     - jvf->palette_size < 0) {
             if (s->error_recognition & AV_EF_EXPLODE) {
-                read_close(s);
-                av_freep(&jv->frames);
-                av_freep(&ast->index_entries);
                 return AVERROR_INVALIDDATA;
             }
             jvf->audio_size   =
@@ -263,4 +259,5 @@  AVInputFormat ff_jv_demuxer = {
     .read_packet    = read_packet,
     .read_seek      = read_seek,
     .read_close     = read_close,
+    .flags_internal = FF_INPUTFORMAT_HEADER_CLEANUP,
 };