From ccd5c8566f151965ebc26d3fdd2071d9053d8520 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 11 Dec 2010 23:15:48 +0000 Subject: [PATCH] demux_ts: fix several memleaks Fixes bug 1280. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32696 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_ts.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/libmpdemux/demux_ts.c b/libmpdemux/demux_ts.c index a68b59396b..daeefdd7bf 100644 --- a/libmpdemux/demux_ts.c +++ b/libmpdemux/demux_ts.c @@ -1116,6 +1116,17 @@ static void demux_close_ts(demuxer_t * demuxer) } 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; @@ -2680,7 +2691,12 @@ static int fill_packet(demuxer_t *demuxer, demux_stream_t *ds, demux_packet_t ** { 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 -- 2.11.4.GIT