diff --git a/libavformat/utils.c b/libavformat/utils.c index a059046a2c..a82bbc702d 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4146,9 +4146,7 @@ static void free_stream(AVStream **pst) av_freep(&st->index_entries); #if FF_API_LAVF_AVCTX FF_DISABLE_DEPRECATION_WARNINGS - av_freep(&st->codec->extradata); - av_freep(&st->codec->subtitle_header); - av_freep(&st->codec); + avcodec_free_context(&st->codec); FF_ENABLE_DEPRECATION_WARNINGS #endif av_freep(&st->priv_data);