From: Andreas Rheinhardt Date: Wed, 14 Apr 2021 23:49:06 +0000 (+0200) Subject: avcodec: Remove redundant freeing of extradata of encoders X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=1c7f252783aec37e4ff8049476386f63afe91756;p=ffmpeg 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 Signed-off-by: Andreas Rheinhardt --- diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index caa90923148..12896de262f 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 6e08a94d416..a67b89b49bc 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 94842797713..3eee95fa040 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 b848cd8851f..a7144e95dde 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 54788e154be..14eabe4e05a 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 8c99b26ddf8..c642037aac4 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 c96e2d87fdb..a7891b367ce 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 f26ab501f42..057cb9f0261 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 8999a18bf41..d0f4c65aacc 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 2bed61f91e1..22c91d8df79 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 3135e221c7b..253f4bde6ad 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 7ba709b1bce..4c635ae86fb 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 b2b33a89c50..c01488f483a 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 da83ef4d321..ac8a5d651cd 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 b89bb206e07..1f7e9b3c91a 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 ; }