Fix minor memory leak.
authorJindřich Makovička <makovick@gmail.com>
Fri, 6 Feb 2009 20:30:18 +0000 (20:30 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Feb 2009 20:30:18 +0000 (20:30 +0000)
Patch by Jindrich Makovicka, approved by mans.

Originally committed as revision 17021 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/mpegts.c

index e335bc66571701a57639ca6447215807a5a9aa61..248a35f0ff2896f57782c6689c6f9ff3c083d494 100644 (file)
@@ -334,6 +334,13 @@ static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter)
     pid = filter->pid;
     if (filter->type == MPEGTS_SECTION)
         av_freep(&filter->u.section_filter.section_buf);
+    else if (filter->type == MPEGTS_PES) {
+        /* referenced private data will be freed later in
+         * av_close_input_stream */
+        if (!((PESContext *)filter->u.pes_filter.opaque)->st) {
+            av_freep(&filter->u.pes_filter.opaque);
+        }
+    }
 
     av_free(filter);
     ts->pids[pid] = NULL;