[FFmpeg-cvslog] avcodec/vb: Cleanup generically after init failure

Andreas Rheinhardt git at videolan.org
Thu Sep 17 01:10:55 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Sun Sep 13 03:51:23 2020 +0200| [b128344dfcfcf167cd7f6b12b82fddc7efddc98d] | committer: Andreas Rheinhardt

avcodec/vb: Cleanup generically after init failure

In other words: Set the FF_CODEC_CAP_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

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

diff --git a/libavcodec/vb.c b/libavcodec/vb.c
index d9c6b93a73..fe419c7663 100644
--- a/libavcodec/vb.c
+++ b/libavcodec/vb.c
@@ -262,11 +262,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
     c->frame      = av_mallocz(avctx->width * avctx->height);
     c->prev_frame = av_mallocz(avctx->width * avctx->height);
 
-    if (!c->frame || !c->prev_frame) {
-        av_freep(&c->frame);
-        av_freep(&c->prev_frame);
+    if (!c->frame || !c->prev_frame)
         return AVERROR(ENOMEM);
-    }
 
     return 0;
 }
@@ -291,4 +288,5 @@ AVCodec ff_vb_decoder = {
     .close          = decode_end,
     .decode         = decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };



More information about the ffmpeg-cvslog mailing list