diff --git a/libavformat/utils.c b/libavformat/utils.c index abc90c3c70..a88d9598dc 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3683,9 +3683,7 @@ void ff_free_stream(AVFormatContext *s, AVStream *st) { av_dict_free(&st->metadata); av_freep(&st->probe_data.buf); av_freep(&st->index_entries); - av_freep(&st->codec->extradata); - av_freep(&st->codec->subtitle_header); - av_freep(&st->codec); + avcodec_free_context(&st->codec); av_freep(&st->priv_data); if (st->info) av_freep(&st->info->duration_error);