[FFmpeg-cvslog] lavf: free packets for muxers implementing interleave_packet().

Anton Khirnov git at videolan.org
Thu Jan 19 01:35:32 CET 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Jan 18 08:07:40 2012 +0100| [aa2e4bb0580b519156a6a34f1ee71cf063dfcaee] | committer: Anton Khirnov

lavf: free packets for muxers implementing interleave_packet().

Fixes a memleak.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aa2e4bb0580b519156a6a34f1ee71cf063dfcaee
---

 libavformat/utils.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 373f068..b1832ba 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3218,9 +3218,12 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pk
  *         < 0 if an error occurred
  */
 static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush){
-    if(s->oformat->interleave_packet)
-        return s->oformat->interleave_packet(s, out, in, flush);
-    else
+    if (s->oformat->interleave_packet) {
+        int ret = s->oformat->interleave_packet(s, out, in, flush);
+        if (in)
+            av_free_packet(in);
+        return ret;
+    } else
         return av_interleave_packet_per_dts(s, out, in, flush);
 }
 



More information about the ffmpeg-cvslog mailing list