[vlc-devel] commit: ty demux: simplify and fix potential memleak (CID 214) ( Derk-Jan Hartman )
git version control
git at videolan.org
Sat Oct 11 04:57:52 CEST 2008
vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Sat Oct 11 04:57:19 2008 +0200| [d7fc7b2d4894e27740a2d46cd8aed6791df25e9f] | committer: Derk-Jan Hartman
ty demux: simplify and fix potential memleak (CID 214)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d7fc7b2d4894e27740a2d46cd8aed6791df25e9f
---
modules/demux/ty.c | 23 ++++++++---------------
1 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/modules/demux/ty.c b/modules/demux/ty.c
index 7e3a2a4..754e235 100644
--- a/modules/demux/ty.c
+++ b/modules/demux/ty.c
@@ -789,24 +789,17 @@ static int DemuxRecVideo( demux_t *p_demux, ty_rec_hdr_t *rec_hdr, block_t *p_bl
/* Send the CC data */
if( p_block_in->i_pts > 0 && p_sys->cc.i_data > 0 )
{
- int i_cc_count;
-
- block_t *p_cc = block_New( p_demux, p_sys->cc.i_data );
- p_cc->i_flags |= BLOCK_FLAG_TYPE_I;
- p_cc->i_pts = p_block_in->i_pts;
- memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
-
- for( i = 0, i_cc_count = 0; i < 4; i++ )
- i_cc_count += p_sys->p_cc[i] ? 1 : 0;
-
for( i = 0; i < 4; i++ )
{
- if( !p_sys->p_cc[i] )
- continue;
- if( i_cc_count > 1 )
- es_out_Send( p_demux->out, p_sys->p_cc[i], block_Duplicate( p_cc ) );
- else
+ if( p_sys->p_cc[i] )
+ {
+ block_t *p_cc = block_New( p_demux, p_sys->cc.i_data );
+ p_cc->i_flags |= BLOCK_FLAG_TYPE_I;
+ p_cc->i_pts = p_block_in->i_pts;
+ memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
+
es_out_Send( p_demux->out, p_sys->p_cc[i], p_cc );
+ }
}
cc_Flush( &p_sys->cc );
}
More information about the vlc-devel
mailing list