Commit 457d3ca6 authored by Rémi Duraffort's avatar Rémi Duraffort Committed by Christophe Massiot

Constify and fix memleaks.

parent d8df8201
......@@ -269,6 +269,7 @@ static void ReadConfiguration( char *psz_file )
p_output->i_config |= OUTPUT_STILL_PRESENT;
}
free( psz_displayname );
free( pi_pids );
freeaddrinfo( p_addr );
}
......@@ -586,6 +587,7 @@ int main( int i_argc, char **pp_argv )
else
msg_Err( NULL, "Invalid configuration for -d switch: %s" , optarg);
free( psz_displayname );
freeaddrinfo( p_daddr );
break;
}
......
......@@ -169,8 +169,8 @@ void demux_Change( output_t *p_output, uint16_t i_sid,
void demux_ResendCAPMTs( void );
int PIDIsSelected( uint16_t i_pid );
output_t *output_Create( uint8_t i_config, 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 );
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, const char *psz_displayname, void *p_init_data );
void output_Close( output_t *p_output );
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 );
/*****************************************************************************
* 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;
output_t *p_output = NULL;
......@@ -78,7 +78,7 @@ output_t *output_Create( uint8_t i_config, char *psz_displayname, void *p_init_d
/*****************************************************************************
* 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_depth = 0;
......@@ -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_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;
p_output->i_addrlen = p_ai->ai_addrlen;
......@@ -136,6 +136,7 @@ void output_Close( output_t *p_output )
block_Delete( p_output->pp_blocks[i] );
}
free( p_output->psz_displayname );
p_output->i_depth = 0;
p_output->i_config &= ~OUTPUT_VALID;
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