Commit a9c31c5a authored by Henri Fallon's avatar Henri Fallon

- Fixed a netlist packet leak in demuxPSI (Mark Gritter <mgritter@kealia.com>).

- Removed the nuts message "unable to allocate memory" when the netlist got
empty.

- Cosmetic changes.
parent 9ad4cc80
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
HEAD HEAD
* Added gnome.h check and cleaned the error messages in the configure script * Fixed a packet leak in DemuxPSI.
* Added gnome.h check and cleaned the error messages in the configure script.
* Tiny small optim in LPCM decoder. * Tiny small optim in LPCM decoder.
0.2.83 0.2.83
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ts.c: TS demux and netlist management * input_ts.c: TS demux and netlist management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ts.c,v 1.32 2001/08/27 16:13:20 massiot Exp $ * $Id: input_ts.c,v 1.33 2001/09/06 18:21:02 henri Exp $
* *
* Authors: Henri Fallon <henri@videolan.org> * Authors: Henri Fallon <henri@videolan.org>
* *
...@@ -280,14 +280,6 @@ static int TSRead( input_thread_t * p_input, ...@@ -280,14 +280,6 @@ static int TSRead( input_thread_t * p_input,
struct iovec * p_iovec; struct iovec * p_iovec;
struct timeval timeout; struct timeval timeout;
/* Get iovecs */
p_iovec = input_NetlistGetiovec( p_input->p_method_data );
if ( p_iovec == NULL )
{
return( -1 ); /* empty netlist */
}
/* Init */ /* Init */
p_method = ( thread_ts_data_t * )p_input->p_plugin_data; p_method = ( thread_ts_data_t * )p_input->p_plugin_data;
...@@ -319,6 +311,14 @@ static int TSRead( input_thread_t * p_input, ...@@ -319,6 +311,14 @@ static int TSRead( input_thread_t * p_input,
if( i_data ) if( i_data )
{ {
/* Get iovecs */
p_iovec = input_NetlistGetiovec( p_input->p_method_data );
if ( p_iovec == NULL )
{
return( -1 ); /* empty netlist */
}
#if defined( WIN32 ) #if defined( WIN32 )
if( p_input->stream.b_pace_control ) if( p_input->stream.b_pace_control )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_netlist.c: netlist management * input_netlist.c: netlist management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_netlist.c,v 1.41 2001/07/30 00:53:05 sam Exp $ * $Id: input_netlist.c,v 1.42 2001/09/06 18:21:02 henri Exp $
* *
* Authors: Henri Fallon <henri@videolan.org> * Authors: Henri Fallon <henri@videolan.org>
* *
...@@ -212,7 +212,7 @@ struct iovec * input_NetlistGetiovec( void * p_method_data ) ...@@ -212,7 +212,7 @@ struct iovec * input_NetlistGetiovec( void * p_method_data )
( (p_netlist->i_data_end - p_netlist->i_data_start + p_netlist->i_nb_data) ( (p_netlist->i_data_end - p_netlist->i_data_start + p_netlist->i_nb_data)
& ( p_netlist->i_nb_data -1 ) ) < p_netlist->i_read_once ) & ( p_netlist->i_nb_data -1 ) ) < p_netlist->i_read_once )
{ {
intf_ErrMsg("Empty iovec FIFO. Unable to allocate memory"); intf_ErrMsg("Empty iovec FIFO.");
return (NULL); return (NULL);
} }
...@@ -303,7 +303,7 @@ struct data_packet_s * input_NetlistNewPacket( void * p_method_data, ...@@ -303,7 +303,7 @@ struct data_packet_s * input_NetlistNewPacket( void * p_method_data,
/* check */ /* check */
if ( p_netlist->i_data_start == p_netlist->i_data_end ) if ( p_netlist->i_data_start == p_netlist->i_data_end )
{ {
intf_ErrMsg("Empty Data FIFO in netlist. Unable to allocate memory"); intf_ErrMsg("Empty Data FIFO in netlist.");
return ( NULL ); return ( NULL );
} }
...@@ -342,7 +342,7 @@ struct pes_packet_s * input_NetlistNewPES( void * p_method_data ) ...@@ -342,7 +342,7 @@ struct pes_packet_s * input_NetlistNewPES( void * p_method_data )
/* check */ /* check */
if ( p_netlist->i_pes_start == p_netlist->i_pes_end ) if ( p_netlist->i_pes_start == p_netlist->i_pes_end )
{ {
intf_ErrMsg("Empty PES FIFO in netlist - Unable to allocate memory"); intf_ErrMsg("Empty PES FIFO in netlist");
return ( NULL ); return ( NULL );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mpeg_system.c: TS, PS and PES management * mpeg_system.c: TS, PS and PES management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: mpeg_system.c,v 1.56 2001/07/18 15:21:51 massiot Exp $ * $Id: mpeg_system.c,v 1.57 2001/09/06 18:21:02 henri Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr> * Michel Lespinasse <walken@via.ecp.fr>
...@@ -1256,19 +1256,7 @@ void input_DemuxPSI( input_thread_t * p_input, data_packet_t * p_data, ...@@ -1256,19 +1256,7 @@ void input_DemuxPSI( input_thread_t * p_input, data_packet_t * p_data,
{ {
/* This was the last section of PSI */ /* This was the last section of PSI */
p_psi->b_is_complete = 1; p_psi->b_is_complete = 1;
}
}
else
{
memcpy( p_psi->buffer, p, p_data->p_payload_end - p );
p_psi->i_read_in_section+= p_data->p_payload_end - p;
p_psi->p_current += p_data->p_payload_end - p;
}
}
if ( p_psi->b_is_complete )
{
switch( p_demux_data->i_psi_type) switch( p_demux_data->i_psi_type)
{ {
case PSI_IS_PAT: case PSI_IS_PAT:
...@@ -1281,9 +1269,21 @@ void input_DemuxPSI( input_thread_t * p_input, data_packet_t * p_data, ...@@ -1281,9 +1269,21 @@ void input_DemuxPSI( input_thread_t * p_input, data_packet_t * p_data,
intf_WarnMsg(2, "Received unknown PSI in demuxPSI"); intf_WarnMsg(2, "Received unknown PSI in demuxPSI");
} }
} }
}
else
{
memcpy( p_psi->buffer, p, p_data->p_payload_end - p );
p_psi->i_read_in_section+= p_data->p_payload_end - p;
p_psi->p_current += p_data->p_payload_end - p;
}
}
#undef p_psi #undef p_psi
#undef p #undef p
p_input->pf_delete_packet( p_input->p_method_data, p_data );
return ; return ;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment