[FFmpeg-cvslog] avcodec/decode: increase nb_bsfs after av_bsf_alloc in case alloc failed

Limin Wang git at videolan.org
Sun Mar 22 14:11:49 EET 2020


ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Tue Dec 24 09:06:18 2019 +0800| [a289cc564338e4278bad07dfaee74c6262bdab30] | committer: Michael Niedermayer

avcodec/decode: increase nb_bsfs after av_bsf_alloc in case alloc failed

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a289cc564338e4278bad07dfaee74c6262bdab30
---

 libavcodec/decode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 07b64b387b..af6bb3f952 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -227,13 +227,13 @@ int ff_decode_bsfs_init(AVCodecContext *avctx)
             goto fail;
         }
         s->bsfs = tmp;
-        s->nb_bsfs++;
 
-        ret = av_bsf_alloc(filter, &s->bsfs[s->nb_bsfs - 1]);
+        ret = av_bsf_alloc(filter, &s->bsfs[s->nb_bsfs]);
         if (ret < 0) {
             av_freep(&bsf);
             goto fail;
         }
+        s->nb_bsfs++;
 
         if (s->nb_bsfs == 1) {
             /* We do not currently have an API for passing the input timebase into decoders,



More information about the ffmpeg-cvslog mailing list