Commit b674dab8 authored by Rémi Duraffort's avatar Rémi Duraffort

Remove unneeded msg_Error about memory failure.

Fix a double malloc.
Fix potential segfault.
parent 7d1d56fe
...@@ -634,7 +634,6 @@ int CDDAOpen( vlc_object_t *p_this ) ...@@ -634,7 +634,6 @@ int CDDAOpen( vlc_object_t *p_this )
p_cdda = calloc( 1, sizeof(cdda_data_t) ); p_cdda = calloc( 1, sizeof(cdda_data_t) );
if( p_cdda == NULL ) if( p_cdda == NULL )
{ {
msg_Err( p_access, "out of memory" );
free( psz_source ); free( psz_source );
return VLC_ENOMEM; return VLC_ENOMEM;
} }
......
...@@ -227,10 +227,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -227,10 +227,7 @@ static int Open( vlc_object_t *p_this )
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 ) if( !p_sys )
{
msg_Err( p_demux, "not enough memory available" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
memset( p_sys, 0, sizeof( demux_sys_t ) ); memset( p_sys, 0, sizeof( demux_sys_t ) );
memset( &fmt, 0, sizeof( es_format_t ) ); memset( &fmt, 0, sizeof( es_format_t ) );
......
...@@ -339,7 +339,7 @@ static int OpenWithCookies( vlc_object_t *p_this, vlc_array_t *cookies ) ...@@ -339,7 +339,7 @@ static int OpenWithCookies( vlc_object_t *p_this, vlc_array_t *cookies )
if (proxies[0]) if (proxies[0])
{ {
msg_Dbg(p_access, "libproxy suggest to use '%s'", proxies[0]); msg_Dbg(p_access, "libproxy suggest to use '%s'", proxies[0]);
if(strcmp(proxies[0],"direct://") != 0) if(strcmp(proxies[0],"direct://") != 0)
{ {
p_sys->b_proxy = true; p_sys->b_proxy = true;
vlc_UrlParse( &p_sys->proxy, proxies[0], 0); vlc_UrlParse( &p_sys->proxy, proxies[0], 0);
......
...@@ -88,10 +88,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -88,10 +88,7 @@ static int Open( vlc_object_t *p_this )
p_sys->p_thread = p_sys->p_thread =
vlc_object_create( p_access, sizeof( rtmp_control_thread_t ) ); vlc_object_create( p_access, sizeof( rtmp_control_thread_t ) );
if( !p_sys->p_thread ) if( !p_sys->p_thread )
{
msg_Err( p_access, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
vlc_object_attach( p_sys->p_thread, p_access ); vlc_object_attach( p_sys->p_thread, p_access );
/* Parse URI - remove spaces */ /* Parse URI - remove spaces */
......
...@@ -1662,18 +1662,12 @@ static int InitRead( demux_t *p_demux, int i_fd, unsigned int i_buffer_size ) ...@@ -1662,18 +1662,12 @@ static int InitRead( demux_t *p_demux, int i_fd, unsigned int i_buffer_size )
p_sys->p_buffers = calloc( 1, sizeof( *p_sys->p_buffers ) ); p_sys->p_buffers = calloc( 1, sizeof( *p_sys->p_buffers ) );
if( !p_sys->p_buffers ) if( !p_sys->p_buffers )
{
msg_Err( p_demux, "Out of memory" );
goto open_failed; goto open_failed;
}
p_sys->p_buffers[0].length = i_buffer_size; p_sys->p_buffers[0].length = i_buffer_size;
p_sys->p_buffers[0].start = malloc( i_buffer_size ); p_sys->p_buffers[0].start = malloc( i_buffer_size );
if( !p_sys->p_buffers[0].start ) if( !p_sys->p_buffers[0].start )
{
msg_Err( p_demux, "Out of memory" );
goto open_failed; goto open_failed;
}
return VLC_SUCCESS; return VLC_SUCCESS;
......
...@@ -96,10 +96,7 @@ vcddev_t *ioctl_Open( vlc_object_t *p_this, const char *psz_dev ) ...@@ -96,10 +96,7 @@ vcddev_t *ioctl_Open( vlc_object_t *p_this, const char *psz_dev )
*/ */
p_vcddev = (vcddev_t *)malloc( sizeof(vcddev_t) ); p_vcddev = (vcddev_t *)malloc( sizeof(vcddev_t) );
if( p_vcddev == NULL ) if( p_vcddev == NULL )
{
msg_Err( p_this, "out of memory" );
return NULL; return NULL;
}
p_vcddev->i_vcdimage_handle = -1; p_vcddev->i_vcdimage_handle = -1;
p_vcddev->psz_dev = NULL; p_vcddev->psz_dev = NULL;
b_is_file = 1; b_is_file = 1;
...@@ -211,10 +208,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, ...@@ -211,10 +208,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev,
{ {
*pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) );
if( *pp_sectors == NULL ) if( *pp_sectors == NULL )
{
msg_Err( p_this, "out of memory" );
return 0; return 0;
}
memcpy( *pp_sectors, p_vcddev->p_sectors, memcpy( *pp_sectors, p_vcddev->p_sectors,
(i_tracks + 1) * sizeof(int) ); (i_tracks + 1) * sizeof(int) );
} }
...@@ -251,7 +245,6 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, ...@@ -251,7 +245,6 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev,
*pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) );
if( *pp_sectors == NULL ) if( *pp_sectors == NULL )
{ {
msg_Err( p_this, "out of memory" );
darwin_freeTOC( pTOC ); darwin_freeTOC( pTOC );
return 0; return 0;
} }
...@@ -360,7 +353,6 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, ...@@ -360,7 +353,6 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev,
{ {
free( *pp_sectors ); free( *pp_sectors );
free( p_fulltoc ); free( p_fulltoc );
msg_Err( p_this, "out of memory" );
CloseHandle( hEvent ); CloseHandle( hEvent );
return 0; return 0;
} }
...@@ -423,10 +415,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, ...@@ -423,10 +415,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev,
*pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) );
if( *pp_sectors == NULL ) if( *pp_sectors == NULL )
{
msg_Err( p_this, "out of memory" );
return 0; return 0;
}
for( i = 0 ; i <= i_tracks ; i++ ) for( i = 0 ; i <= i_tracks ; i++ )
{ {
...@@ -459,10 +448,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, ...@@ -459,10 +448,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev,
*pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) );
if( *pp_sectors == NULL ) if( *pp_sectors == NULL )
{
msg_Err( p_this, "out of memory" );
return 0; return 0;
}
toc_entries.address_format = CD_LBA_FORMAT; toc_entries.address_format = CD_LBA_FORMAT;
toc_entries.starting_track = 0; toc_entries.starting_track = 0;
...@@ -472,7 +458,6 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, ...@@ -472,7 +458,6 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev,
malloc( toc_entries.data_len ); malloc( toc_entries.data_len );
if( toc_entries.data == NULL ) if( toc_entries.data == NULL )
{ {
msg_Err( p_this, "out of memory" );
free( *pp_sectors ); free( *pp_sectors );
return 0; return 0;
} }
...@@ -518,10 +503,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, ...@@ -518,10 +503,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev,
*pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) );
if( *pp_sectors == NULL ) if( *pp_sectors == NULL )
{
msg_Err( p_this, "out of memory" );
return 0; return 0;
}
/* Fill the p_sectors structure with the track/sector matches */ /* Fill the p_sectors structure with the track/sector matches */
for( i = 0 ; i <= i_tracks ; i++ ) for( i = 0 ; i <= i_tracks ; i++ )
......
...@@ -106,10 +106,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -106,10 +106,7 @@ static int Create( vlc_object_t *p_this )
/* Allocate the memory needed to store the module's structure */ /* Allocate the memory needed to store the module's structure */
p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) ); p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) );
if ( p_filter->p_sys == NULL ) if ( p_filter->p_sys == NULL )
{ return VLC_ENOMEM;
msg_Err( p_filter, "out of memory" );
return VLC_EGENERIC;
}
p_filter->p_sys->i_left = -1; p_filter->p_sys->i_left = -1;
p_filter->p_sys->i_center = -1; p_filter->p_sys->i_center = -1;
p_filter->p_sys->i_right = -1; p_filter->p_sys->i_right = -1;
......
...@@ -245,10 +245,7 @@ static int Init( vlc_object_t *p_this, struct aout_filter_sys_t * p_data ...@@ -245,10 +245,7 @@ static int Init( vlc_object_t *p_this, struct aout_filter_sys_t * p_data
p_data->p_atomic_operations = malloc( sizeof(struct atomic_operation_t) p_data->p_atomic_operations = malloc( sizeof(struct atomic_operation_t)
* p_data->i_nb_atomic_operations ); * p_data->i_nb_atomic_operations );
if( p_data->p_atomic_operations == NULL ) if( p_data->p_atomic_operations == NULL )
{
msg_Err( p_this, "out of memory" );
return -1; return -1;
}
/* For each virtual speaker, computes elementary wave propagation time /* For each virtual speaker, computes elementary wave propagation time
* to each ear */ * to each ear */
...@@ -346,10 +343,7 @@ static int Init( vlc_object_t *p_this, struct aout_filter_sys_t * p_data ...@@ -346,10 +343,7 @@ static int Init( vlc_object_t *p_this, struct aout_filter_sys_t * p_data
} }
p_data->p_overflow_buffer = malloc( p_data->i_overflow_buffer_size ); p_data->p_overflow_buffer = malloc( p_data->i_overflow_buffer_size );
if( p_data->p_atomic_operations == NULL ) if( p_data->p_atomic_operations == NULL )
{
msg_Err( p_this, "out of memory" );
return -1; return -1;
}
memset( p_data->p_overflow_buffer, 0 , p_data->i_overflow_buffer_size ); memset( p_data->p_overflow_buffer, 0 , p_data->i_overflow_buffer_size );
/* end */ /* end */
...@@ -411,10 +405,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -411,10 +405,7 @@ static int Create( vlc_object_t *p_this )
/* Allocate the memory needed to store the module's structure */ /* Allocate the memory needed to store the module's structure */
p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) ); p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) );
if( p_filter->p_sys == NULL ) if( p_filter->p_sys == NULL )
{ return VLC_ENOMEM;
msg_Err( p_filter, "out of memory" );
return VLC_EGENERIC;
}
p_filter->p_sys->i_overflow_buffer_size = 0; p_filter->p_sys->i_overflow_buffer_size = 0;
p_filter->p_sys->p_overflow_buffer = NULL; p_filter->p_sys->p_overflow_buffer = NULL;
p_filter->p_sys->i_nb_atomic_operations = 0; p_filter->p_sys->i_nb_atomic_operations = 0;
...@@ -626,10 +617,7 @@ static int OpenFilter( vlc_object_t *p_this ) ...@@ -626,10 +617,7 @@ static int OpenFilter( vlc_object_t *p_this )
/* Allocate the memory needed to store the module's structure */ /* Allocate the memory needed to store the module's structure */
p_filter->p_sys = malloc( sizeof(struct filter_sys_t) ); p_filter->p_sys = malloc( sizeof(struct filter_sys_t) );
if( p_filter->p_sys == NULL ) if( p_filter->p_sys == NULL )
{ return VLC_ENOMEM;
msg_Err( p_filter, "out of memory" );
return VLC_EGENERIC;
}
p_filter->p_sys->i_overflow_buffer_size = 0; p_filter->p_sys->i_overflow_buffer_size = 0;
p_filter->p_sys->p_overflow_buffer = NULL; p_filter->p_sys->p_overflow_buffer = NULL;
p_filter->p_sys->i_nb_atomic_operations = 0; p_filter->p_sys->i_nb_atomic_operations = 0;
......
...@@ -247,10 +247,7 @@ static int Init( vlc_object_t *p_this, struct filter_sys_t * p_data, ...@@ -247,10 +247,7 @@ static int Init( vlc_object_t *p_this, struct filter_sys_t * p_data,
p_data->p_atomic_operations = malloc( sizeof(struct atomic_operation_t) p_data->p_atomic_operations = malloc( sizeof(struct atomic_operation_t)
* p_data->i_nb_atomic_operations ); * p_data->i_nb_atomic_operations );
if( p_data->p_atomic_operations == NULL ) if( p_data->p_atomic_operations == NULL )
{
msg_Err( p_this, "out of memory" );
return -1; return -1;
}
/* For each virtual speaker, computes elementary wave propagation time /* For each virtual speaker, computes elementary wave propagation time
* to each ear */ * to each ear */
...@@ -348,10 +345,7 @@ static int Init( vlc_object_t *p_this, struct filter_sys_t * p_data, ...@@ -348,10 +345,7 @@ static int Init( vlc_object_t *p_this, struct filter_sys_t * p_data,
} }
p_data->p_overflow_buffer = malloc( p_data->i_overflow_buffer_size ); p_data->p_overflow_buffer = malloc( p_data->i_overflow_buffer_size );
if( p_data->p_atomic_operations == NULL ) if( p_data->p_atomic_operations == NULL )
{
msg_Err( p_this, "out of memory" );
return -1; return -1;
}
memset( p_data->p_overflow_buffer, 0, p_data->i_overflow_buffer_size ); memset( p_data->p_overflow_buffer, 0, p_data->i_overflow_buffer_size );
/* end */ /* end */
...@@ -393,10 +387,7 @@ static int OpenFilter( vlc_object_t *p_this ) ...@@ -393,10 +387,7 @@ static int OpenFilter( vlc_object_t *p_this )
/* Allocate the memory needed to store the module's structure */ /* Allocate the memory needed to store the module's structure */
p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) ); p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) );
if( p_sys == NULL ) if( p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_EGENERIC; return VLC_EGENERIC;
}
var_Create( p_this, MONO_CFG "downmix", var_Create( p_this, MONO_CFG "downmix",
VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
......
...@@ -149,10 +149,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -149,10 +149,7 @@ static int Create( vlc_object_t *p_this )
p_sys = malloc( sizeof(filter_sys_t) ); p_sys = malloc( sizeof(filter_sys_t) );
p_filter->p_sys = (struct aout_filter_sys_t *)p_sys; p_filter->p_sys = (struct aout_filter_sys_t *)p_sys;
if( p_sys == NULL ) if( p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return -1; return -1;
}
i_ret = Open( VLC_OBJECT(p_filter), p_sys, i_ret = Open( VLC_OBJECT(p_filter), p_sys,
p_filter->input, p_filter->output ); p_filter->input, p_filter->output );
...@@ -444,10 +441,7 @@ static int OpenFilter( vlc_object_t *p_this ) ...@@ -444,10 +441,7 @@ static int OpenFilter( vlc_object_t *p_this )
/* Allocate the memory needed to store the module's structure */ /* Allocate the memory needed to store the module's structure */
p_filter->p_sys = p_sys = malloc( sizeof(filter_sys_t) ); p_filter->p_sys = p_sys = malloc( sizeof(filter_sys_t) );
if( p_sys == NULL ) if( p_sys == NULL )
{ return VLC_ENOMEM;
msg_Err( p_filter, "out of memory" );
return VLC_EGENERIC;
}
i_ret = Open( VLC_OBJECT(p_filter), p_sys, i_ret = Open( VLC_OBJECT(p_filter), p_sys,
p_filter->fmt_in.audio, p_filter->fmt_out.audio ); p_filter->fmt_in.audio, p_filter->fmt_out.audio );
......
...@@ -128,10 +128,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -128,10 +128,7 @@ static int Create( vlc_object_t *p_this )
p_sys = malloc( sizeof(filter_sys_t) ); p_sys = malloc( sizeof(filter_sys_t) );
p_filter->p_sys = (struct aout_filter_sys_t *)p_sys; p_filter->p_sys = (struct aout_filter_sys_t *)p_sys;
if( p_sys == NULL ) if( p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return -1; return -1;
}
i_ret = Open( VLC_OBJECT(p_filter), p_sys, i_ret = Open( VLC_OBJECT(p_filter), p_sys,
p_filter->input, p_filter->output ); p_filter->input, p_filter->output );
...@@ -402,18 +399,7 @@ static int OpenFilter( vlc_object_t *p_this ) ...@@ -402,18 +399,7 @@ static int OpenFilter( vlc_object_t *p_this )
/* Allocate the memory needed to store the module's structure */ /* Allocate the memory needed to store the module's structure */
p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) ); p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) );
if( p_sys == NULL ) if( p_sys == NULL )
{ return VLC_ENOMEM;
msg_Err( p_filter, "out of memory" );
return VLC_EGENERIC;
}
/* Allocate the memory needed to store the module's structure */
p_filter->p_sys = p_sys = malloc( sizeof(filter_sys_t) );
if( p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_EGENERIC;
}
i_ret = Open( VLC_OBJECT(p_filter), p_sys, i_ret = Open( VLC_OBJECT(p_filter), p_sys,
p_filter->fmt_in.audio, p_filter->fmt_out.audio ); p_filter->fmt_in.audio, p_filter->fmt_out.audio );
......
...@@ -91,10 +91,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -91,10 +91,7 @@ static int Create( vlc_object_t *p_this )
/* Allocate the memory needed to store the module's structure */ /* Allocate the memory needed to store the module's structure */
p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) ); p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) );
if( p_filter->p_sys == NULL ) if( p_filter->p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
memset( p_filter->p_sys, 0, sizeof(struct aout_filter_sys_t) ); memset( p_filter->p_sys, 0, sizeof(struct aout_filter_sys_t) );
p_filter->p_sys->p_buf = 0; p_filter->p_sys->p_buf = 0;
......
...@@ -104,10 +104,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -104,10 +104,7 @@ static int Create( vlc_object_t *p_this )
p_sys = malloc( sizeof(filter_sys_t) ); p_sys = malloc( sizeof(filter_sys_t) );
p_filter->p_sys = (struct aout_filter_sys_t *)p_sys; p_filter->p_sys = (struct aout_filter_sys_t *)p_sys;
if( p_sys == NULL ) if( p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return -1; return -1;
}
/* Initialize libmad */ /* Initialize libmad */
mad_stream_init( &p_sys->mad_stream ); mad_stream_init( &p_sys->mad_stream );
...@@ -316,10 +313,7 @@ static int OpenFilter( vlc_object_t *p_this ) ...@@ -316,10 +313,7 @@ static int OpenFilter( vlc_object_t *p_this )
/* Allocate the memory needed to store the module's structure */ /* Allocate the memory needed to store the module's structure */
p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) ); p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) );
if( p_sys == NULL ) if( p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return -1; return -1;
}
p_sys->i_reject_count = 0; p_sys->i_reject_count = 0;
p_filter->pf_audio_filter = Convert; p_filter->pf_audio_filter = Convert;
......
...@@ -119,10 +119,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -119,10 +119,7 @@ static int Create( vlc_object_t *p_this )
/* Allocate the memory needed to store the module's structure */ /* Allocate the memory needed to store the module's structure */
p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) ); p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) );
if( p_filter->p_sys == NULL ) if( p_filter->p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
/* Calculate worst case for the length of the filter wing */ /* Calculate worst case for the length of the filter wing */
d_factor = (double)p_filter->output.i_rate d_factor = (double)p_filter->output.i_rate
...@@ -135,10 +132,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -135,10 +132,7 @@ static int Create( vlc_object_t *p_this )
/* Allocate enough memory to buffer previous samples */ /* Allocate enough memory to buffer previous samples */
p_filter->p_sys->p_buf = malloc( p_filter->p_sys->i_buf_size ); p_filter->p_sys->p_buf = malloc( p_filter->p_sys->i_buf_size );
if( p_filter->p_sys->p_buf == NULL ) if( p_filter->p_sys->p_buf == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
p_filter->p_sys->i_old_wing = 0; p_filter->p_sys->i_old_wing = 0;
p_filter->pf_do_work = DoWork; p_filter->pf_do_work = DoWork;
......
...@@ -99,17 +99,11 @@ static int Create( vlc_object_t *p_this ) ...@@ -99,17 +99,11 @@ static int Create( vlc_object_t *p_this )
p_sys = malloc( sizeof(filter_sys_t) ); p_sys = malloc( sizeof(filter_sys_t) );
p_filter->p_sys = (struct aout_filter_sys_t *)p_sys; p_filter->p_sys = (struct aout_filter_sys_t *)p_sys;
if( p_sys == NULL ) if( p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
p_sys->p_prev_sample = malloc( p_sys->p_prev_sample = malloc(
p_filter->input.i_channels * sizeof(int32_t) ); p_filter->input.i_channels * sizeof(int32_t) );
if( p_sys->p_prev_sample == NULL ) if( p_sys->p_prev_sample == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
aout_DateInit( &p_sys->end_date, p_filter->output.i_rate ); aout_DateInit( &p_sys->end_date, p_filter->output.i_rate );
p_filter->pf_do_work = DoWork; p_filter->pf_do_work = DoWork;
...@@ -275,16 +269,12 @@ static int OpenFilter( vlc_object_t *p_this ) ...@@ -275,16 +269,12 @@ static int OpenFilter( vlc_object_t *p_this )
/* Allocate the memory needed to store the module's structure */ /* Allocate the memory needed to store the module's structure */
p_filter->p_sys = p_sys = malloc( sizeof(struct filter_sys_t) ); p_filter->p_sys = p_sys = malloc( sizeof(struct filter_sys_t) );
if( p_sys == NULL ) if( p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
p_sys->p_prev_sample = malloc( p_sys->p_prev_sample = malloc(
p_filter->fmt_in.audio.i_channels * sizeof(int32_t) ); p_filter->fmt_in.audio.i_channels * sizeof(int32_t) );
if( p_sys->p_prev_sample == NULL ) if( p_sys->p_prev_sample == NULL )
{ {
msg_Err( p_filter, "out of memory" );
free( p_sys ); free( p_sys );
return VLC_ENOMEM; return VLC_ENOMEM;
} }
......
...@@ -289,10 +289,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -289,10 +289,7 @@ static int Create( vlc_object_t *p_this )
/* Allocate structure */ /* Allocate structure */
p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) ); p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) );
if( !p_sys ) if( !p_sys )
{
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
p_sys->p_face = 0; p_sys->p_face = 0;
p_sys->p_library = 0; p_sys->p_library = 0;
p_sys->i_font_size = 0; p_sys->i_font_size = 0;
...@@ -324,10 +321,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -324,10 +321,7 @@ static int Create( vlc_object_t *p_this )
free( psz_fontfile ); free( psz_fontfile );
psz_fontfile = (char *)malloc( PATH_MAX + 1 ); psz_fontfile = (char *)malloc( PATH_MAX + 1 );
if( !psz_fontfile ) if( !psz_fontfile )
{
msg_Err( p_filter, "out of memory" );
goto error; goto error;
}
#ifdef WIN32 #ifdef WIN32
GetWindowsDirectory( psz_fontfile, PATH_MAX + 1 ); GetWindowsDirectory( psz_fontfile, PATH_MAX + 1 );
strcat( psz_fontfile, "\\fonts\\arial.ttf" ); strcat( psz_fontfile, "\\fonts\\arial.ttf" );
...@@ -1128,10 +1122,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, ...@@ -1128,10 +1122,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
psz_unicode = psz_unicode_orig = psz_unicode = psz_unicode_orig =
malloc( ( strlen(psz_string) + 1 ) * sizeof(uint32_t) ); malloc( ( strlen(psz_string) + 1 ) * sizeof(uint32_t) );
if( psz_unicode == NULL ) if( psz_unicode == NULL )
{
msg_Err( p_filter, "out of memory" );
goto error; goto error;
}
#if defined(WORDS_BIGENDIAN) #if defined(WORDS_BIGENDIAN)
iconv_handle = vlc_iconv_open( "UCS-4BE", "UTF-8" ); iconv_handle = vlc_iconv_open( "UCS-4BE", "UTF-8" );
#else #else
...@@ -1174,10 +1165,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, ...@@ -1174,10 +1165,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
p_fribidi_string = malloc( (i_string_length + 1) * sizeof(uint32_t) ); p_fribidi_string = malloc( (i_string_length + 1) * sizeof(uint32_t) );
if( !p_fribidi_string ) if( !p_fribidi_string )
{
msg_Err( p_filter, "out of memory" );
goto error; goto error;
}
/* Do bidi conversion line-by-line */ /* Do bidi conversion line-by-line */
while( pos < i_string_length ) while( pos < i_string_length )
...@@ -1218,10 +1206,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, ...@@ -1218,10 +1206,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
/* Calculate relative glyph positions and a bounding box for the /* Calculate relative glyph positions and a bounding box for the
* entire string */ * entire string */
if( !(p_line = NewLine( strlen( psz_string ))) ) if( !(p_line = NewLine( strlen( psz_string ))) )
{
msg_Err( p_filter, "out of memory" );
goto error; goto error;
}
p_lines = p_line; p_lines = p_line;
i_pen_x = i_pen_y = 0; i_pen_x = i_pen_y = 0;
i_previous = i = 0; i_previous = i = 0;
...@@ -1242,10 +1227,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, ...@@ -1242,10 +1227,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
{ {
psz_line_start = psz_unicode; psz_line_start = psz_unicode;
if( !(p_next = NewLine( strlen( psz_string ))) ) if( !(p_next = NewLine( strlen( psz_string ))) )
{
msg_Err( p_filter, "out of memory" );
goto error; goto error;
}
p_line->p_next = p_next; p_line->p_next = p_next;
p_line->i_width = line.xMax; p_line->i_width = line.xMax;
p_line->i_height = face->size->metrics.height >> 6; p_line->i_height = face->size->metrics.height >> 6;
...@@ -2285,7 +2267,6 @@ static int ProcessLines( filter_t *p_filter, ...@@ -2285,7 +2267,6 @@ static int ProcessLines( filter_t *p_filter,
! p_new_positions || ! p_new_positions ||
! p_levels ) ! p_levels )
{ {
msg_Err( p_filter, "out of memory" );
free( p_levels ); free( p_levels );
free( p_old_positions ); free( p_old_positions );
free( p_new_positions ); free( p_new_positions );
...@@ -2500,7 +2481,6 @@ static int ProcessLines( filter_t *p_filter, ...@@ -2500,7 +2481,6 @@ static int ProcessLines( filter_t *p_filter,
malloc( (k - i_prev + 1) * sizeof( uint32_t )); malloc( (k - i_prev + 1) * sizeof( uint32_t ));
if( !psz_unicode ) if( !psz_unicode )
{ {
msg_Err( p_filter, "out of memory" );
if( p_face ) FT_Done_Face( p_face ); if( p_face ) FT_Done_Face( p_face );
free( pp_char_styles ); free( pp_char_styles );
free( psz_unicode ); free( psz_unicode );
...@@ -2519,7 +2499,6 @@ static int ProcessLines( filter_t *p_filter, ...@@ -2519,7 +2499,6 @@ static int ProcessLines( filter_t *p_filter,
{ {
if( !(p_line = NewLine( i_len - i_prev)) ) if( !(p_line = NewLine( i_len - i_prev)) )
{ {
msg_Err( p_filter, "out of memory" );
if( p_face ) FT_Done_Face( p_face ); if( p_face ) FT_Done_Face( p_face );
free( pp_char_styles ); free( pp_char_styles );
free( psz_unicode ); free( psz_unicode );
......
...@@ -167,10 +167,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -167,10 +167,7 @@ static int Open( vlc_object_t *p_this )
/* Allocate instance and initialize some members */ /* Allocate instance and initialize some members */
p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) ); p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL ) if( p_intf->p_sys == NULL )
{
msg_Err( p_intf, "out of memory" );
return -1; return -1;
}
psz_mode = var_CreateGetString( p_intf, "logmode" ); psz_mode = var_CreateGetString( p_intf, "logmode" );
if( psz_mode ) if( psz_mode )
......
...@@ -142,10 +142,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -142,10 +142,7 @@ static int Create( vlc_object_t *p_this )
// Allocate structure // Allocate structure
p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) ); p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) );
if( !p_sys ) if( !p_sys )
{
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM; return VLC_ENOMEM;
}
p_sys->psz_font_name = strdup( DEFAULT_FONT ); p_sys->psz_font_name = strdup( DEFAULT_FONT );
p_sys->i_font_opacity = 255; p_sys->i_font_opacity = 255;
p_sys->i_font_color = DEFAULT_FONT_COLOR; p_sys->i_font_color = DEFAULT_FONT_COLOR;
......
...@@ -365,10 +365,7 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name, ...@@ -365,10 +365,7 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
int i; int i;
if( !p_media ) if( !p_media )
{
msg_Err( p_vod, "not enough memory" );
return NULL; return NULL;
}
memset( p_media, 0, sizeof(vod_media_t) ); memset( p_media, 0, sizeof(vod_media_t) );
p_media->id = p_sys->i_media_id++; p_media->id = p_sys->i_media_id++;
......
...@@ -178,10 +178,8 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *s ) ...@@ -178,10 +178,8 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *s )
/* Open and read file */ /* Open and read file */
p_buffer = malloc( i_buffer ); p_buffer = malloc( i_buffer );
if( p_buffer == NULL ) { if( p_buffer == NULL )
msg_Err( p_xml, "out of memory" );
return NULL; return NULL;
}
while( ( i_size = stream_Read( s, &p_buffer[i_pos], 2048 ) ) == 2048 ) while( ( i_size = stream_Read( s, &p_buffer[i_pos], 2048 ) ) == 2048 )
{ {
...@@ -190,7 +188,6 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *s ) ...@@ -190,7 +188,6 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *s )
p_new = realloc( p_buffer, i_buffer ); p_new = realloc( p_buffer, i_buffer );
if( !p_new ) if( !p_new )
{ {
msg_Err( p_xml, "out of memory" );
free( p_buffer ); free( p_buffer );
return NULL; return NULL;
} }
......
...@@ -739,10 +739,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -739,10 +739,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
id = malloc( sizeof( sout_stream_id_t ) ); id = malloc( sizeof( sout_stream_id_t ) );
if( !id ) if( !id )
{
msg_Err( p_stream, "out of memory" );
goto error; goto error;
}
memset( id, 0, sizeof(sout_stream_id_t) ); memset( id, 0, sizeof(sout_stream_id_t) );
id->id = NULL; id->id = NULL;
...@@ -752,10 +749,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -752,10 +749,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
/* Create decoder object */ /* Create decoder object */
id->p_decoder = vlc_object_create( p_stream, VLC_OBJECT_DECODER ); id->p_decoder = vlc_object_create( p_stream, VLC_OBJECT_DECODER );
if( !id->p_decoder ) if( !id->p_decoder )
{
msg_Err( p_stream, "out of memory" );
goto error; goto error;
}
vlc_object_attach( id->p_decoder, p_stream ); vlc_object_attach( id->p_decoder, p_stream );
id->p_decoder->p_module = NULL; id->p_decoder->p_module = NULL;
id->p_decoder->fmt_in = *p_fmt; id->p_decoder->fmt_in = *p_fmt;
...@@ -764,10 +758,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -764,10 +758,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
/* Create encoder object */ /* Create encoder object */
id->p_encoder = vlc_object_create( p_stream, VLC_OBJECT_ENCODER ); id->p_encoder = vlc_object_create( p_stream, VLC_OBJECT_ENCODER );
if( !id->p_encoder ) if( !id->p_encoder )
{
msg_Err( p_stream, "out of memory" );
goto error; goto error;
}
vlc_object_attach( id->p_encoder, p_stream ); vlc_object_attach( id->p_encoder, p_stream );
id->p_encoder->p_module = NULL; id->p_encoder->p_module = NULL;
...@@ -931,23 +922,26 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -931,23 +922,26 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
return id; return id;
error: error:
if( id->p_decoder ) if( id )
{ {
vlc_object_detach( id->p_decoder ); if( id->p_decoder )
vlc_object_release( id->p_decoder ); {
id->p_decoder = NULL; vlc_object_detach( id->p_decoder );
} vlc_object_release( id->p_decoder );
id->p_decoder = NULL;
}
if( id->p_encoder ) if( id->p_encoder )
{ {
vlc_object_detach( id->p_encoder ); vlc_object_detach( id->p_encoder );
es_format_Clean( &id->p_encoder->fmt_out ); es_format_Clean( &id->p_encoder->fmt_out );
vlc_object_release( id->p_encoder ); vlc_object_release( id->p_encoder );
id->p_encoder = NULL; id->p_encoder = NULL;
} }
free( id ); free( id );
}
return NULL; return NULL;
} }
......
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