avformat/utils: free AVStream.codec properly in free_stream()
authorAaron Levinson <alevinsn@aracnet.com>
Fri, 21 Apr 2017 06:30:13 +0000 (23:30 -0700)
committerJames Almer <jamrial@gmail.com>
Sat, 20 May 2017 02:37:49 +0000 (23:37 -0300)
Fixes memory leaks.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit b9d2005ea5d6837917a69bc2b8e98f5695f54e39)

libavformat/utils.c

index abc90c3..a88d959 100644 (file)
@@ -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);