Commit 4a73e232 authored by ivoire's avatar ivoire

Constify and fix memleaks.


git-svn-id: svn://svn.videolan.org/dvblast/trunk@114 55d3f8b6-4a41-4d2d-a900-313d1436a5b8
parent 66e290a4
...@@ -269,6 +269,7 @@ static void ReadConfiguration( char *psz_file ) ...@@ -269,6 +269,7 @@ static void ReadConfiguration( char *psz_file )
p_output->i_config |= OUTPUT_STILL_PRESENT; p_output->i_config |= OUTPUT_STILL_PRESENT;
} }
free( psz_displayname );
free( pi_pids ); free( pi_pids );
freeaddrinfo( p_addr ); freeaddrinfo( p_addr );
} }
...@@ -586,6 +587,7 @@ int main( int i_argc, char **pp_argv ) ...@@ -586,6 +587,7 @@ int main( int i_argc, char **pp_argv )
else else
msg_Err( NULL, "Invalid configuration for -d switch: %s" , optarg); msg_Err( NULL, "Invalid configuration for -d switch: %s" , optarg);
free( psz_displayname );
freeaddrinfo( p_daddr ); freeaddrinfo( p_daddr );
break; break;
} }
......
...@@ -169,8 +169,8 @@ void demux_Change( output_t *p_output, uint16_t i_sid, ...@@ -169,8 +169,8 @@ void demux_Change( output_t *p_output, uint16_t i_sid,
void demux_ResendCAPMTs( void ); void demux_ResendCAPMTs( void );
int PIDIsSelected( uint16_t i_pid ); int PIDIsSelected( uint16_t i_pid );
output_t *output_Create( uint8_t i_config, char *psz_displayname, void *p_init_data ); output_t *output_Create( uint8_t i_config, const char *psz_displayname, void *p_init_data );
int output_Init( output_t *p_output, uint8_t i_config, char *psz_displayname, void *p_init_data ); int output_Init( output_t *p_output, uint8_t i_config, const char *psz_displayname, void *p_init_data );
void output_Close( output_t *p_output ); void output_Close( output_t *p_output );
void output_Put( output_t *p_output, block_t *p_block ); void output_Put( output_t *p_output, block_t *p_block );
......
...@@ -46,7 +46,7 @@ static void rtp_SetHdr( output_t *p_output, uint8_t *p_hdr ); ...@@ -46,7 +46,7 @@ static void rtp_SetHdr( output_t *p_output, uint8_t *p_hdr );
/***************************************************************************** /*****************************************************************************
* output_Create : called from main thread * output_Create : called from main thread
*****************************************************************************/ *****************************************************************************/
output_t *output_Create( uint8_t i_config, char *psz_displayname, void *p_init_data ) output_t *output_Create( uint8_t i_config, const char *psz_displayname, void *p_init_data )
{ {
int i; int i;
output_t *p_output = NULL; output_t *p_output = NULL;
...@@ -78,7 +78,7 @@ output_t *output_Create( uint8_t i_config, char *psz_displayname, void *p_init_d ...@@ -78,7 +78,7 @@ output_t *output_Create( uint8_t i_config, char *psz_displayname, void *p_init_d
/***************************************************************************** /*****************************************************************************
* output_Init * output_Init
*****************************************************************************/ *****************************************************************************/
int output_Init( output_t *p_output, uint8_t i_config, char *psz_displayname, void *p_init_data ) int output_Init( output_t *p_output, uint8_t i_config, const char *psz_displayname, void *p_init_data )
{ {
p_output->i_sid = 0; p_output->i_sid = 0;
p_output->i_depth = 0; p_output->i_depth = 0;
...@@ -103,7 +103,7 @@ int output_Init( output_t *p_output, uint8_t i_config, char *psz_displayname, vo ...@@ -103,7 +103,7 @@ int output_Init( output_t *p_output, uint8_t i_config, char *psz_displayname, vo
p_output->i_ref_wallclock = 0; p_output->i_ref_wallclock = 0;
p_output->i_config = i_config; p_output->i_config = i_config;
p_output->psz_displayname = psz_displayname; p_output->psz_displayname = strdup( psz_displayname );
struct addrinfo *p_ai = (struct addrinfo *)p_init_data; struct addrinfo *p_ai = (struct addrinfo *)p_init_data;
p_output->i_addrlen = p_ai->ai_addrlen; p_output->i_addrlen = p_ai->ai_addrlen;
...@@ -136,6 +136,7 @@ void output_Close( output_t *p_output ) ...@@ -136,6 +136,7 @@ void output_Close( output_t *p_output )
block_Delete( p_output->pp_blocks[i] ); block_Delete( p_output->pp_blocks[i] );
} }
free( p_output->psz_displayname );
p_output->i_depth = 0; p_output->i_depth = 0;
p_output->i_config &= ~OUTPUT_VALID; p_output->i_config &= ~OUTPUT_VALID;
close( p_output->i_handle ); close( p_output->i_handle );
......
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