[FFmpeg-cvslog] avcodec: Remove redundant freeing of extradata of encoders

Andreas Rheinhardt git at videolan.org
Wed Apr 28 18:54:10 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Apr 15 01:49:06 2021 +0200| [1c7f252783aec37e4ff8049476386f63afe91756] | committer: Andreas Rheinhardt

avcodec: Remove redundant freeing of extradata of encoders

AVCodecContext.extradata is freed generically by libavcodec for
encoders, so it is unnecessary for an encoder to do it on its own.

Reviewed-by: Anton Khirnov <anton at khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/flacenc.c       | 2 --
 libavcodec/huffyuvenc.c    | 1 -
 libavcodec/lclenc.c        | 1 -
 libavcodec/libfdk-aacenc.c | 1 -
 libavcodec/libkvazaar.c    | 3 ---
 libavcodec/libopusenc.c    | 2 --
 libavcodec/libspeexenc.c   | 1 -
 libavcodec/libtheoraenc.c  | 1 -
 libavcodec/libvorbisenc.c  | 1 -
 libavcodec/libx264.c       | 1 -
 libavcodec/libxavs.c       | 1 -
 libavcodec/libxvid.c       | 1 -
 libavcodec/mpegvideo_enc.c | 2 --
 libavcodec/opusenc.c       | 1 -
 libavcodec/vorbisenc.c     | 2 --
 15 files changed, 21 deletions(-)

diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index caa9092314..12896de262 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -1413,8 +1413,6 @@ static av_cold int flac_encode_close(AVCodecContext *avctx)
         av_freep(&s->md5_buffer);
         ff_lpc_end(&s->lpc_ctx);
     }
-    av_freep(&avctx->extradata);
-    avctx->extradata_size = 0;
     return 0;
 }
 
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index 6e08a94d41..a67b89b49b 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -1005,7 +1005,6 @@ static av_cold int encode_end(AVCodecContext *avctx)
 
     ff_huffyuv_common_end(s);
 
-    av_freep(&avctx->extradata);
     av_freep(&avctx->stats_out);
 
     return 0;
diff --git a/libavcodec/lclenc.c b/libavcodec/lclenc.c
index 9484279771..3eee95fa04 100644
--- a/libavcodec/lclenc.c
+++ b/libavcodec/lclenc.c
@@ -154,7 +154,6 @@ static av_cold int encode_end(AVCodecContext *avctx)
 {
     LclEncContext *c = avctx->priv_data;
 
-    av_freep(&avctx->extradata);
     deflateEnd(&c->zstream);
 
     return 0;
diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index b848cd8851..a7144e95dd 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -112,7 +112,6 @@ static int aac_encode_close(AVCodecContext *avctx)
 
     if (s->handle)
         aacEncClose(&s->handle);
-    av_freep(&avctx->extradata);
     ff_af_queue_close(&s->afq);
 
     return 0;
diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
index 54788e154b..14eabe4e05 100644
--- a/libavcodec/libkvazaar.c
+++ b/libavcodec/libkvazaar.c
@@ -156,9 +156,6 @@ static av_cold int libkvazaar_close(AVCodecContext *avctx)
         ctx->api->config_destroy(ctx->config);
     }
 
-    if (avctx->extradata)
-        av_freep(&avctx->extradata);
-
     return 0;
 }
 
diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c
index 8c99b26ddf..c642037aac 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -432,7 +432,6 @@ static av_cold int libopus_encode_init(AVCodecContext *avctx)
 
 fail:
     opus_multistream_encoder_destroy(enc);
-    av_freep(&avctx->extradata);
     return ret;
 }
 
@@ -538,7 +537,6 @@ static av_cold int libopus_encode_close(AVCodecContext *avctx)
     ff_af_queue_close(&opus->afq);
 
     av_freep(&opus->samples);
-    av_freep(&avctx->extradata);
 
     return 0;
 }
diff --git a/libavcodec/libspeexenc.c b/libavcodec/libspeexenc.c
index c96e2d87fd..a7891b367c 100644
--- a/libavcodec/libspeexenc.c
+++ b/libavcodec/libspeexenc.c
@@ -318,7 +318,6 @@ static av_cold int encode_close(AVCodecContext *avctx)
     speex_encoder_destroy(s->enc_state);
 
     ff_af_queue_close(&s->afq);
-    av_freep(&avctx->extradata);
 
     return 0;
 }
diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c
index f26ab501f4..057cb9f026 100644
--- a/libavcodec/libtheoraenc.c
+++ b/libavcodec/libtheoraenc.c
@@ -360,7 +360,6 @@ static av_cold int encode_close(AVCodecContext* avc_context)
     th_encode_free(h->t_state);
     av_freep(&h->stats);
     av_freep(&avc_context->stats_out);
-    av_freep(&avc_context->extradata);
     avc_context->extradata_size = 0;
 
     return 0;
diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c
index 8999a18bf4..d0f4c65aac 100644
--- a/libavcodec/libvorbisenc.c
+++ b/libavcodec/libvorbisenc.c
@@ -196,7 +196,6 @@ static av_cold int libvorbis_encode_close(AVCodecContext *avctx)
 
     av_fifo_freep(&s->pkt_fifo);
     ff_af_queue_close(&s->afq);
-    av_freep(&avctx->extradata);
 
     av_vorbis_parse_free(&s->vp);
 
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 2bed61f91e..22c91d8df7 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -497,7 +497,6 @@ static av_cold int X264_close(AVCodecContext *avctx)
 {
     X264Context *x4 = avctx->priv_data;
 
-    av_freep(&avctx->extradata);
     av_freep(&x4->sei);
     av_freep(&x4->reordered_opaque);
 
diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c
index 3135e221c7..253f4bde6a 100644
--- a/libavcodec/libxavs.c
+++ b/libavcodec/libxavs.c
@@ -207,7 +207,6 @@ static av_cold int XAVS_close(AVCodecContext *avctx)
 {
     XavsContext *x4 = avctx->priv_data;
 
-    av_freep(&avctx->extradata);
     av_freep(&x4->sei);
     av_freep(&x4->pts_buffer);
 
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index 7ba709b1bc..4c635ae86f 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -858,7 +858,6 @@ static av_cold int xvid_encode_close(AVCodecContext *avctx)
         x->encoder_handle = NULL;
     }
 
-    av_freep(&avctx->extradata);
     if (x->twopassbuffer) {
         av_freep(&x->twopassbuffer);
         av_freep(&x->old_twopassbuffer);
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index b2b33a89c5..c01488f483 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -961,8 +961,6 @@ av_cold int ff_mpv_encode_end(AVCodecContext *avctx)
         s->out_format == FMT_MJPEG)
         ff_mjpeg_encode_close(s);
 
-    av_freep(&avctx->extradata);
-
     for (i = 0; i < FF_ARRAY_ELEMS(s->tmp_frames); i++)
         av_frame_free(&s->tmp_frames[i]);
 
diff --git a/libavcodec/opusenc.c b/libavcodec/opusenc.c
index da83ef4d32..ac8a5d651c 100644
--- a/libavcodec/opusenc.c
+++ b/libavcodec/opusenc.c
@@ -614,7 +614,6 @@ static av_cold int opus_encode_end(AVCodecContext *avctx)
     ff_af_queue_close(&s->afq);
     ff_opus_psy_end(&s->psyctx);
     ff_bufqueue_discard_all(&s->bufqueue);
-    av_freep(&avctx->extradata);
 
     return 0;
 }
diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index b89bb206e0..1f7e9b3c91 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -1254,8 +1254,6 @@ static av_cold int vorbis_encode_close(AVCodecContext *avctx)
     ff_af_queue_close(&venc->afq);
     ff_bufqueue_discard_all(&venc->bufqueue);
 
-    av_freep(&avctx->extradata);
-
     return 0 ;
 }
 



More information about the ffmpeg-cvslog mailing list