Commit 37a2578c authored by Rémi Duraffort's avatar Rémi Duraffort

Remove unneeded msg_Err.

Fix potential segfault (check malloc return value).
parent 172e22c2
...@@ -313,10 +313,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -313,10 +313,7 @@ static int Open( vlc_object_t *p_this )
/* Allocate structures */ /* Allocate structures */
p_aout->output.p_sys = p_sys = malloc( sizeof( aout_sys_t ) ); p_aout->output.p_sys = p_sys = malloc( sizeof( aout_sys_t ) );
if( p_sys == NULL ) if( p_sys == NULL )
{
msg_Err( p_aout, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
p_sys->b_playing = false; p_sys->b_playing = false;
p_sys->start_date = 0; p_sys->start_date = 0;
vlc_cond_init( p_aout, &p_sys->wait ); vlc_cond_init( p_aout, &p_sys->wait );
......
...@@ -83,10 +83,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -83,10 +83,7 @@ static int Open( vlc_object_t *p_this )
/* Allocate structure */ /* Allocate structure */
p_sys = malloc( sizeof( aout_sys_t ) ); p_sys = malloc( sizeof( aout_sys_t ) );
if( p_sys == NULL ) if( p_sys == NULL )
{
msg_Err( p_aout, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
p_aout->output.p_sys = p_sys; p_aout->output.p_sys = p_sys;
i_err = arts_init(); i_err = arts_init();
......
...@@ -161,10 +161,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -161,10 +161,7 @@ static int Open( vlc_object_t * p_this )
/* Allocate structure */ /* Allocate structure */
p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) ); p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->output.p_sys == NULL ) if( p_aout->output.p_sys == NULL )
{ return VLC_ENOMEM;
msg_Err( p_aout, "out of memory" );
return( VLC_ENOMEM );
}
p_sys = p_aout->output.p_sys; p_sys = p_aout->output.p_sys;
p_sys->i_default_dev = 0; p_sys->i_default_dev = 0;
...@@ -649,10 +646,7 @@ static int OpenSPDIF( aout_instance_t * p_aout ) ...@@ -649,10 +646,7 @@ static int OpenSPDIF( aout_instance_t * p_aout )
i_streams = i_param_size / sizeof( AudioStreamID ); i_streams = i_param_size / sizeof( AudioStreamID );
p_streams = (AudioStreamID *)malloc( i_param_size ); p_streams = (AudioStreamID *)malloc( i_param_size );
if( p_streams == NULL ) if( p_streams == NULL )
{
msg_Err( p_aout, "out of memory" );
return false; return false;
}
err = AudioDeviceGetProperty( p_sys->i_selected_dev, 0, FALSE, err = AudioDeviceGetProperty( p_sys->i_selected_dev, 0, FALSE,
kAudioDevicePropertyStreams, kAudioDevicePropertyStreams,
...@@ -685,10 +679,7 @@ static int OpenSPDIF( aout_instance_t * p_aout ) ...@@ -685,10 +679,7 @@ static int OpenSPDIF( aout_instance_t * p_aout )
i_formats = i_param_size / sizeof( AudioStreamBasicDescription ); i_formats = i_param_size / sizeof( AudioStreamBasicDescription );
p_format_list = (AudioStreamBasicDescription *)malloc( i_param_size ); p_format_list = (AudioStreamBasicDescription *)malloc( i_param_size );
if( p_format_list == NULL ) if( p_format_list == NULL )
{
msg_Err( p_aout, "could not malloc the memory" );
continue; continue;
}
err = AudioStreamGetProperty( p_streams[i], 0, err = AudioStreamGetProperty( p_streams[i], 0,
kAudioStreamPropertyPhysicalFormats, kAudioStreamPropertyPhysicalFormats,
...@@ -951,10 +942,7 @@ static void Probe( aout_instance_t * p_aout ) ...@@ -951,10 +942,7 @@ static void Probe( aout_instance_t * p_aout )
/* Allocate DeviceID array */ /* Allocate DeviceID array */
p_devices = (AudioDeviceID*)malloc( sizeof(AudioDeviceID) * p_sys->i_devices ); p_devices = (AudioDeviceID*)malloc( sizeof(AudioDeviceID) * p_sys->i_devices );
if( p_devices == NULL ) if( p_devices == NULL )
{
msg_Err( p_aout, "out of memory" );
goto error; goto error;
}
/* Populate DeviceID array */ /* Populate DeviceID array */
err = AudioHardwareGetProperty( kAudioHardwarePropertyDevices, err = AudioHardwareGetProperty( kAudioHardwarePropertyDevices,
...@@ -1101,10 +1089,7 @@ static int AudioDeviceSupportsDigital( aout_instance_t *p_aout, AudioDeviceID i_ ...@@ -1101,10 +1089,7 @@ static int AudioDeviceSupportsDigital( aout_instance_t *p_aout, AudioDeviceID i_
i_streams = i_param_size / sizeof( AudioStreamID ); i_streams = i_param_size / sizeof( AudioStreamID );
p_streams = (AudioStreamID *)malloc( i_param_size ); p_streams = (AudioStreamID *)malloc( i_param_size );
if( p_streams == NULL ) if( p_streams == NULL )
{
msg_Err( p_aout, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
err = AudioDeviceGetProperty( i_dev_id, 0, FALSE, err = AudioDeviceGetProperty( i_dev_id, 0, FALSE,
kAudioDevicePropertyStreams, kAudioDevicePropertyStreams,
...@@ -1150,10 +1135,7 @@ static int AudioStreamSupportsDigital( aout_instance_t *p_aout, AudioStreamID i_ ...@@ -1150,10 +1135,7 @@ static int AudioStreamSupportsDigital( aout_instance_t *p_aout, AudioStreamID i_
i_formats = i_param_size / sizeof( AudioStreamBasicDescription ); i_formats = i_param_size / sizeof( AudioStreamBasicDescription );
p_format_list = (AudioStreamBasicDescription *)malloc( i_param_size ); p_format_list = (AudioStreamBasicDescription *)malloc( i_param_size );
if( p_format_list == NULL ) if( p_format_list == NULL )
{
msg_Err( p_aout, "could not malloc the memory" );
return false; return false;
}
err = AudioStreamGetProperty( i_stream_id, 0, err = AudioStreamGetProperty( i_stream_id, 0,
kAudioStreamPropertyPhysicalFormats, kAudioStreamPropertyPhysicalFormats,
......
...@@ -254,10 +254,7 @@ static int OpenAudio( vlc_object_t *p_this ) ...@@ -254,10 +254,7 @@ static int OpenAudio( vlc_object_t *p_this )
/* Allocate structure */ /* Allocate structure */
p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) ); p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->output.p_sys == NULL ) if( p_aout->output.p_sys == NULL )
{
msg_Err( p_aout, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
/* Initialize some variables */ /* Initialize some variables */
p_aout->output.p_sys->p_dsobject = NULL; p_aout->output.p_sys->p_dsobject = NULL;
......
...@@ -91,10 +91,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -91,10 +91,7 @@ static int Open( vlc_object_t *p_this )
/* Allocate structure */ /* Allocate structure */
p_sys = malloc( sizeof( aout_sys_t ) ); p_sys = malloc( sizeof( aout_sys_t ) );
if( p_sys == NULL ) if( p_sys == NULL )
{
msg_Err( p_aout, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
p_aout->output.p_sys = p_sys; p_aout->output.p_sys = p_sys;
......
...@@ -154,10 +154,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -154,10 +154,7 @@ static int Open( vlc_object_t * p_this )
/* Allocate structure */ /* Allocate structure */
p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) ); p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->output.p_sys == NULL ) if( p_aout->output.p_sys == NULL )
{ return VLC_ENOMEM;
msg_Err( p_aout, "out of memory" );
return VLC_EGENERIC;
}
if( !strcmp( psz_name, "-" ) ) if( !strcmp( psz_name, "-" ) )
p_aout->output.p_sys->p_file = stdout; p_aout->output.p_sys->p_file = stdout;
......
...@@ -97,18 +97,14 @@ static int Open( vlc_object_t * p_this ) ...@@ -97,18 +97,14 @@ static int Open( vlc_object_t * p_this )
p_aout->output.p_sys = p_sys = p_aout->output.p_sys = p_sys =
(aout_sys_t *)malloc( sizeof( aout_sys_t ) ); (aout_sys_t *)malloc( sizeof( aout_sys_t ) );
if( p_aout->output.p_sys == NULL ) if( p_aout->output.p_sys == NULL )
{ return VLC_ENOMEM;
msg_Err( p_aout, "out of memory" );
return VLC_EGENERIC;
}
/* New PCMAudioPlayer */ /* New PCMAudioPlayer */
p_sys->pPlayer = pPlayer = new PCMAudioPlayer(); p_sys->pPlayer = pPlayer = new PCMAudioPlayer();
if( p_sys->pPlayer == NULL ) if( p_sys->pPlayer == NULL )
{ {
msg_Err( p_aout, "out of memory" );
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_ENOMEM;
} }
/* Get Buffer Requirements */ /* Get Buffer Requirements */
...@@ -127,10 +123,9 @@ static int Open( vlc_object_t * p_this ) ...@@ -127,10 +123,9 @@ static int Open( vlc_object_t * p_this )
p_sys->ppBuffers = (void **)malloc( p_sys->nBuffers * sizeof( void * ) ); p_sys->ppBuffers = (void **)malloc( p_sys->nBuffers * sizeof( void * ) );
if( p_sys->ppBuffers == NULL ) if( p_sys->ppBuffers == NULL )
{ {
msg_Err( p_aout, "out of memory" );
delete pPlayer; delete pPlayer;
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_ENOMEM;
} }
/* Open PCMAudioPlayer */ /* Open PCMAudioPlayer */
......
...@@ -108,7 +108,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -108,7 +108,6 @@ static int Open( vlc_object_t *p_this )
p_sys = calloc( 1, sizeof( aout_sys_t ) ); p_sys = calloc( 1, sizeof( aout_sys_t ) );
if( p_sys == NULL ) if( p_sys == NULL )
{ {
msg_Err( p_aout, "out of memory" );
status = VLC_ENOMEM; status = VLC_ENOMEM;
goto error_out; goto error_out;
} }
...@@ -143,7 +142,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -143,7 +142,6 @@ static int Open( vlc_object_t *p_this )
sizeof(jack_port_t *) ); sizeof(jack_port_t *) );
if( p_sys->p_jack_ports == NULL ) if( p_sys->p_jack_ports == NULL )
{ {
msg_Err( p_aout, "out of memory" );
status = VLC_ENOMEM; status = VLC_ENOMEM;
goto error_out; goto error_out;
} }
...@@ -152,7 +150,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -152,7 +150,6 @@ static int Open( vlc_object_t *p_this )
sizeof(jack_sample_t *) ); sizeof(jack_sample_t *) );
if( p_sys->p_jack_buffers == NULL ) if( p_sys->p_jack_buffers == NULL )
{ {
msg_Err( p_aout, "out of memory" );
status = VLC_ENOMEM; status = VLC_ENOMEM;
goto error_out; goto error_out;
} }
......
...@@ -279,10 +279,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -279,10 +279,7 @@ static int Open( vlc_object_t *p_this )
/* Allocate structure */ /* Allocate structure */
p_aout->output.p_sys = p_sys = malloc( sizeof( aout_sys_t ) ); p_aout->output.p_sys = p_sys = malloc( sizeof( aout_sys_t ) );
if( p_sys == NULL ) if( p_sys == NULL )
{
msg_Err( p_aout, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
/* Get device name */ /* Get device name */
if( (psz_device = config_GetPsz( p_aout, "dspdev" )) == NULL ) if( (psz_device = config_GetPsz( p_aout, "dspdev" )) == NULL )
......
...@@ -181,10 +181,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -181,10 +181,7 @@ static int Open( vlc_object_t * p_this )
/* Allocate p_sys structure */ /* Allocate p_sys structure */
p_sys = (aout_sys_t *)malloc( sizeof(aout_sys_t) ); p_sys = (aout_sys_t *)malloc( sizeof(aout_sys_t) );
if( p_sys == NULL ) if( p_sys == NULL )
{
msg_Err( p_aout, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
p_sys->p_aout = p_aout; p_sys->p_aout = p_aout;
p_sys->p_stream = 0; p_sys->p_stream = 0;
p_aout->output.p_sys = p_sys; p_aout->output.p_sys = p_sys;
......
...@@ -245,10 +245,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -245,10 +245,7 @@ static int Open( vlc_object_t *p_this )
p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) ); p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->output.p_sys == NULL ) if( p_aout->output.p_sys == NULL )
{ return VLC_ENOMEM;
msg_Err( p_aout, "out of memory" );
return VLC_EGENERIC;
}
p_aout->output.pf_play = Play; p_aout->output.pf_play = Play;
p_aout->b_die = false; p_aout->b_die = false;
...@@ -411,7 +408,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -411,7 +408,6 @@ static int Open( vlc_object_t *p_this )
if( p_aout->output.p_sys->p_silence_buffer == NULL ) if( p_aout->output.p_sys->p_silence_buffer == NULL )
{ {
free( p_aout->output.p_sys ); free( p_aout->output.p_sys );
msg_Err( p_aout, "out of memory" );
return 1; return 1;
} }
p_aout->output.p_sys->i_repeat_counter = 0; p_aout->output.p_sys->i_repeat_counter = 0;
......
...@@ -100,7 +100,6 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -100,7 +100,6 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
if( ( p_dec->p_sys = p_sys = if( ( p_dec->p_sys = p_sys =
(decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL ) (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
{ {
msg_Err( p_dec, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
} }
...@@ -139,12 +138,15 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -139,12 +138,15 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_context->extradata = p_sys->p_context->extradata =
malloc( p_sys->p_context->extradata_size + malloc( p_sys->p_context->extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE ); FF_INPUT_BUFFER_PADDING_SIZE );
memcpy( p_sys->p_context->extradata, if( p_sys->p_context->extradata )
(char*)p_dec->fmt_in.p_extra + i_offset, {
p_sys->p_context->extradata_size ); memcpy( p_sys->p_context->extradata,
memset( (char*)p_sys->p_context->extradata + (char*)p_dec->fmt_in.p_extra + i_offset,
p_sys->p_context->extradata_size, 0, p_sys->p_context->extradata_size );
FF_INPUT_BUFFER_PADDING_SIZE ); memset( (char*)p_sys->p_context->extradata +
p_sys->p_context->extradata_size, 0,
FF_INPUT_BUFFER_PADDING_SIZE );
}
} }
else else
p_sys->p_context->extradata = NULL; p_sys->p_context->extradata = NULL;
......
...@@ -84,7 +84,6 @@ int OpenDeinterlace( vlc_object_t *p_this ) ...@@ -84,7 +84,6 @@ int OpenDeinterlace( vlc_object_t *p_this )
if( ( p_filter->p_sys = p_sys = if( ( p_filter->p_sys = p_sys =
(filter_sys_t *)malloc(sizeof(filter_sys_t)) ) == NULL ) (filter_sys_t *)malloc(sizeof(filter_sys_t)) ) == NULL )
{ {
msg_Err( p_filter, "out of memory" );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
...@@ -253,10 +253,7 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -253,10 +253,7 @@ int OpenEncoder( vlc_object_t *p_this )
/* Allocate the memory needed to store the encoder's structure */ /* Allocate the memory needed to store the encoder's structure */
if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL ) if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
{ return VLC_ENOMEM;
msg_Err( p_enc, "out of memory" );
return VLC_EGENERIC;
}
memset( p_sys, 0, sizeof(encoder_sys_t) ); memset( p_sys, 0, sizeof(encoder_sys_t) );
p_enc->p_sys = p_sys; p_enc->p_sys = p_sys;
p_sys->p_codec = p_codec; p_sys->p_codec = p_codec;
......
...@@ -232,7 +232,6 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -232,7 +232,6 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
if( ( p_dec->p_sys = p_sys = if( ( p_dec->p_sys = p_sys =
(decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL ) (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
{ {
msg_Err( p_dec, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
} }
memset( p_sys, 0, sizeof(decoder_sys_t) ); memset( p_sys, 0, sizeof(decoder_sys_t) );
......
...@@ -108,7 +108,6 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -108,7 +108,6 @@ static int OpenDecoder( vlc_object_t *p_this )
if( ( p_dec->p_sys = p_sys = if( ( p_dec->p_sys = p_sys =
(decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL ) (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
{ {
msg_Err( p_dec, "out of memory" );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
...@@ -520,7 +520,6 @@ static int DecOpen( vlc_object_t *p_this ) ...@@ -520,7 +520,6 @@ static int DecOpen( vlc_object_t *p_this )
if( ( p_dec->p_sys = p_sys = if( ( p_dec->p_sys = p_sys =
(decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL ) (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
{ {
msg_Err( p_dec, "out of memory" );
goto error; goto error;
} }
...@@ -1341,7 +1340,6 @@ static int EncOpen( vlc_object_t *p_this ) ...@@ -1341,7 +1340,6 @@ static int EncOpen( vlc_object_t *p_this )
if( ( p_enc->p_sys = p_sys = if( ( p_enc->p_sys = p_sys =
(encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL ) (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
{ {
msg_Err( p_enc, "out of memory" );
goto error; goto error;
} }
......
...@@ -1664,10 +1664,7 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -1664,10 +1664,7 @@ static int OpenEncoder( vlc_object_t *p_this )
/* Allocate the memory needed to store the decoder's structure */ /* Allocate the memory needed to store the decoder's structure */
if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL ) if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
{
msg_Err( p_enc, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
p_enc->p_sys = p_sys; p_enc->p_sys = p_sys;
p_enc->pf_encode_sub = Encode; p_enc->pf_encode_sub = Encode;
......
...@@ -160,10 +160,7 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -160,10 +160,7 @@ static int OpenDecoder( vlc_object_t *p_this )
/* Allocate the memory needed to store the decoder's structure */ /* Allocate the memory needed to store the decoder's structure */
p_dec->p_sys = p_sys = malloc( sizeof( *p_sys ) ); p_dec->p_sys = p_sys = malloc( sizeof( *p_sys ) );
if( p_sys == NULL ) if( p_sys == NULL )
{
msg_Err( p_dec, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
/* init of p_sys */ /* init of p_sys */
memset( p_sys, 0, sizeof( *p_sys ) ); memset( p_sys, 0, sizeof( *p_sys ) );
......
...@@ -79,7 +79,6 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -79,7 +79,6 @@ static int OpenDecoder( vlc_object_t *p_this )
if( ( p_dec->p_sys = p_sys = if( ( p_dec->p_sys = p_sys =
(decoder_sys_t *)calloc(1, sizeof(decoder_sys_t)) ) == NULL ) (decoder_sys_t *)calloc(1, sizeof(decoder_sys_t)) ) == NULL )
{ {
msg_Err( p_dec, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
} }
...@@ -400,7 +399,6 @@ static subpicture_region_t *CreateTextRegion( decoder_t *p_dec, ...@@ -400,7 +399,6 @@ static subpicture_region_t *CreateTextRegion( decoder_t *p_dec,
p_text_region->psz_html = strndup( psz_subtitle, i_len ); p_text_region->psz_html = strndup( psz_subtitle, i_len );
if( ! p_text_region->psz_html ) if( ! p_text_region->psz_html )
{ {
msg_Err( p_dec, "out of memory" );
p_spu->pf_destroy_region( VLC_OBJECT(p_dec), p_text_region ); p_spu->pf_destroy_region( VLC_OBJECT(p_dec), p_text_region );
return NULL; return NULL;
} }
...@@ -649,7 +647,6 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) ...@@ -649,7 +647,6 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
p_style = calloc( 1, sizeof(ssa_style_t) ); p_style = calloc( 1, sizeof(ssa_style_t) );
if( ! p_style ) if( ! p_style )
{ {
msg_Err( p_dec, "out of memory" );
free( psz_node ); free( psz_node );
break; break;
} }
......
...@@ -356,10 +356,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -356,10 +356,7 @@ static int Open( vlc_object_t * p_this )
{ {
avi_track_t *tk = malloc( sizeof( avi_track_t ) ); avi_track_t *tk = malloc( sizeof( avi_track_t ) );
if( !tk ) if( !tk )
{
msg_Err( p_demux, "Out of memory" );
goto error; goto error;
}
avi_chunk_list_t *p_strl = AVI_ChunkFind( p_hdrl, AVIFOURCC_strl, i ); avi_chunk_list_t *p_strl = AVI_ChunkFind( p_hdrl, AVIFOURCC_strl, i );
avi_chunk_strh_t *p_strh = AVI_ChunkFind( p_strl, AVIFOURCC_strh, 0 ); avi_chunk_strh_t *p_strh = AVI_ChunkFind( p_strl, AVIFOURCC_strh, 0 );
......
...@@ -156,11 +156,8 @@ static char* GetLine( demux_t *p_demux, int *p_pos ) ...@@ -156,11 +156,8 @@ static char* GetLine( demux_t *p_demux, int *p_pos )
i--; i--;
} }
p_line = malloc( i + 1 ); p_line = malloc( i + 1 );
if( NULL == p_line ) if( p_line == NULL )
{
msg_Err( p_demux, "out of memory" );
return NULL; return NULL;
}
strncpy ( p_line, (char*)p_buf, i ); strncpy ( p_line, (char*)p_buf, i );
p_line[i] = '\0'; p_line[i] = '\0';
// msg_Dbg( p_demux, "i = %d, pos = %d, %s", i, *p_pos, p_line ); // msg_Dbg( p_demux, "i = %d, pos = %d, %s", i, *p_pos, p_line );
......
...@@ -545,10 +545,7 @@ static bool parse_track_node COMPLEX_INTERFACE ...@@ -545,10 +545,7 @@ static bool parse_track_node COMPLEX_INTERFACE
strlen(p_demux->p_sys->psz_base) + strlen(p_demux->p_sys->psz_base) +
strlen(psz_uri) +1 ); strlen(psz_uri) +1 );
if( !psz_tmp ) if( !psz_tmp )
{
msg_Err( p_demux, "out of memory");
return false; return false;
}
sprintf( psz_tmp, "%s%s", sprintf( psz_tmp, "%s%s",
p_demux->p_sys->psz_base, psz_uri ); p_demux->p_sys->psz_base, psz_uri );
free( psz_uri ); free( psz_uri );
......
...@@ -449,7 +449,6 @@ static int Open ( vlc_object_t *p_this ) ...@@ -449,7 +449,6 @@ static int Open ( vlc_object_t *p_this )
if( !( p_sys->subtitle = realloc( p_sys->subtitle, if( !( p_sys->subtitle = realloc( p_sys->subtitle,
sizeof(subtitle_t) * i_max ) ) ) sizeof(subtitle_t) * i_max ) ) )
{ {
msg_Err( p_demux, "out of memory");
free( p_sys->subtitle ); free( p_sys->subtitle );
TextUnload( &p_sys->txt ); TextUnload( &p_sys->txt );
free( p_sys ); free( p_sys );
......
...@@ -140,6 +140,8 @@ static int Open ( vlc_object_t *p_this ) ...@@ -140,6 +140,8 @@ static int Open ( vlc_object_t *p_this )
p_demux->pf_demux = Demux; p_demux->pf_demux = Demux;
p_demux->pf_control = Control; p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
if( !p_sys )
return VLC_ENOMEM;
p_sys->psz_header = NULL; p_sys->psz_header = NULL;
p_sys->i_subtitle = 0; p_sys->i_subtitle = 0;
p_sys->i_subtitles = 0; p_sys->i_subtitles = 0;
...@@ -220,7 +222,6 @@ static int Open ( vlc_object_t *p_this ) ...@@ -220,7 +222,6 @@ static int Open ( vlc_object_t *p_this )
p_data = malloc( i_ssize ); p_data = malloc( i_ssize );
if( !p_data ) if( !p_data )
{ {
msg_Err( p_demux, "out of memory");
free( p_sys ); free( p_sys );
return VLC_ENOMEM; return VLC_ENOMEM;
} }
...@@ -281,7 +282,6 @@ static int ProcessLine( demux_t *p_demux, void *p_arg, ...@@ -281,7 +282,6 @@ static int ProcessLine( demux_t *p_demux, void *p_arg,
if( !( p_sys->subtitle = realloc( p_sys->subtitle, sizeof(subtitle_t) if( !( p_sys->subtitle = realloc( p_sys->subtitle, sizeof(subtitle_t)
* p_sys->i_subs_alloc ) ) ) * p_sys->i_subs_alloc ) ) )
{ {
msg_Err( p_demux, "out of memory");
return VLC_ENOMEM; return VLC_ENOMEM;
} }
} }
......
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