[MPlayer-cvslog] r32696 - trunk/libmpdemux/demux_ts.c

reimar subversion at mplayerhq.hu
Sun Dec 12 00:15:48 CET 2010


Author: reimar
Date: Sun Dec 12 00:15:48 2010
New Revision: 32696

Log:
Fix several memleaks in TS demuxer.
Fixes bug 1280.

Modified:
   trunk/libmpdemux/demux_ts.c

Modified: trunk/libmpdemux/demux_ts.c
==============================================================================
--- trunk/libmpdemux/demux_ts.c	Sat Dec 11 23:26:57 2010	(r32695)
+++ trunk/libmpdemux/demux_ts.c	Sun Dec 12 00:15:48 2010	(r32696)
@@ -1114,6 +1114,17 @@ static void demux_close_ts(demuxer_t * d
 			}
 			free(priv->pmt);
 		}
+		for (i = 0; i < NB_PID_MAX; i++)
+		{
+			free(priv->ts.pids[i]);
+			priv->ts.pids[i] = NULL;
+		}
+		for (i = 0; i < 3; i++)
+		{
+			if (priv->fifo[i].pack)
+				free_demux_packet(priv->fifo[i].pack);
+			priv->fifo[i].pack = NULL;
+		}
 		free(priv);
 	}
 	demuxer->priv=NULL;
@@ -2678,7 +2689,12 @@ static int fill_packet(demuxer_t *demuxe
 {
 	int ret = 0;
 
-	if((*dp != NULL) && (*dp_offset > 0))
+	if(*dp && *dp_offset <= 0)
+	{
+		free_demux_packet(*dp);
+		*dp = NULL;
+	}
+	if(*dp)
 	{
 		ret = *dp_offset;
 		resize_demux_packet(*dp, ret);	//shrinked to the right size


More information about the MPlayer-cvslog mailing list