[FFmpeg-cvslog] avcodec/av1dec: Remove redundant second free

Andreas Rheinhardt git at videolan.org
Thu Sep 17 06:47:39 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Sun Sep 13 21:35:12 2020 +0200| [3e057dd8b1ae7c455f0a8a761962349a06d592a7] | committer: Andreas Rheinhardt

avcodec/av1dec: Remove redundant second free

The AV1 decoder has the FF_CODEC_CAP_INIT_CLEANUP flag set and yet
the decoder's close function is called manually on some error paths.
This is unnecessary and has been removed in this commit.

Reviewed-by: James Almer <jamrial at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

 libavcodec/av1dec.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 871db76b4d..cb46801202 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -480,7 +480,6 @@ static av_cold int av1_decode_init(AVCodecContext *avctx)
     for (int i = 0; i < FF_ARRAY_ELEMS(s->ref); i++) {
         s->ref[i].tf.f = av_frame_alloc();
         if (!s->ref[i].tf.f) {
-            av1_decode_free(avctx);
             av_log(avctx, AV_LOG_ERROR,
                    "Failed to allocate reference frame buffer %d.\n", i);
             return AVERROR(ENOMEM);
@@ -489,7 +488,6 @@ static av_cold int av1_decode_init(AVCodecContext *avctx)
 
     s->cur_frame.tf.f = av_frame_alloc();
     if (!s->cur_frame.tf.f) {
-        av1_decode_free(avctx);
         av_log(avctx, AV_LOG_ERROR,
                "Failed to allocate current frame buffer.\n");
         return AVERROR(ENOMEM);
@@ -504,7 +502,7 @@ static av_cold int av1_decode_init(AVCodecContext *avctx)
                           avctx->extradata_size);
         if (ret < 0) {
             av_log(avctx, AV_LOG_WARNING, "Failed to read extradata.\n");
-            goto end;
+            return ret;
         }
 
         seq = ((CodedBitstreamAV1Context *)(s->cbc->priv_data))->sequence_header;



More information about the ffmpeg-cvslog mailing list