changeset 32609:3ca30fb56837

Fix several memleaks in TS demuxer. Fixes bug 1280.
author reimar
date Sat, 11 Dec 2010 23:15:48 +0000
parents 75c7654261d0
children 2e5c286a464a
files libmpdemux/demux_ts.c
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_ts.c	Sat Dec 11 22:26:57 2010 +0000
+++ b/libmpdemux/demux_ts.c	Sat Dec 11 23:15:48 2010 +0000
@@ -1114,6 +1114,17 @@
 			}
 			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 @@
 {
 	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