lavf: free packets for muxers implementing interleave_packet().
authorAnton Khirnov <anton@khirnov.net>
Wed, 18 Jan 2012 07:07:40 +0000 (08:07 +0100)
committerAnton Khirnov <anton@khirnov.net>
Wed, 18 Jan 2012 19:10:26 +0000 (20:10 +0100)
Fixes a memleak.

libavformat/utils.c

index 373f068..b1832ba 100644 (file)
@@ -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);
 }