avformat/utils: fix memory leak in avformat_free_context
authorSteven Siloti <ssiloti@bittorrent.com>
Tue, 18 Jul 2017 18:26:39 +0000 (11:26 -0700)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 9 Sep 2017 23:33:28 +0000 (01:33 +0200)
The pointer to the packet queue is stored in the internal structure
so the queue needs to be flushed before internal is freed.

Signed-off-by: Steven Siloti <ssiloti@bittorrent.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 949debd1d1df3a96315b3a3083831162845c1188)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/utils.c

index a9f8cf6..ff55fc8 100644 (file)
@@ -4199,8 +4199,8 @@ void avformat_free_context(AVFormatContext *s)
     av_dict_free(&s->metadata);
     av_dict_free(&s->internal->id3v2_meta);
     av_freep(&s->streams);
-    av_freep(&s->internal);
     flush_packet_queue(s);
+    av_freep(&s->internal);
     av_free(s);
 }