diff mbox series

[FFmpeg-devel,13/21] avformat/av1dec: Simplify cleanup after read_header error

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

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
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/av1dec.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c
index 1be2fac1c1..3bf7b598a0 100644
--- a/libavformat/av1dec.c
+++ b/libavformat/av1dec.c
@@ -174,16 +174,10 @@  static int annexb_read_header(AVFormatContext *s)
         return ret;
 
     ret = avcodec_parameters_copy(c->bsf->par_in, st->codecpar);
-    if (ret < 0) {
-        av_bsf_free(&c->bsf);
-        return ret;
-    }
-
-    ret = av_bsf_init(c->bsf);
     if (ret < 0)
-        av_bsf_free(&c->bsf);
+        return ret;
 
-    return ret;
+    return av_bsf_init(c->bsf);
 }
 
 static int annexb_read_packet(AVFormatContext *s, AVPacket *pkt)
@@ -276,4 +270,5 @@  AVInputFormat ff_av1_demuxer = {
     .extensions     = "obu",
     .flags          = AVFMT_GENERIC_INDEX,
     .priv_class     = &annexb_demuxer_class,
+    .flags_internal = FF_INPUTFORMAT_HEADER_CLEANUP,
 };