Fix a double malloc.
Fix potential segfault.
p_cdda = calloc( 1, sizeof(cdda_data_t) );
if( p_cdda == NULL )
{
- msg_Err( p_access, "out of memory" );
free( psz_source );
return VLC_ENOMEM;
}
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
if( !p_sys )
- {
- msg_Err( p_demux, "not enough memory available" );
return VLC_ENOMEM;
- }
memset( p_sys, 0, sizeof( demux_sys_t ) );
memset( &fmt, 0, sizeof( es_format_t ) );
if (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;
vlc_UrlParse( &p_sys->proxy, proxies[0], 0);
p_sys->p_thread =
vlc_object_create( p_access, sizeof( rtmp_control_thread_t ) );
if( !p_sys->p_thread )
- {
- msg_Err( p_access, "out of memory" );
return VLC_ENOMEM;
- }
vlc_object_attach( p_sys->p_thread, p_access );
/* Parse URI - remove spaces */
p_sys->p_buffers = calloc( 1, sizeof( *p_sys->p_buffers ) );
if( !p_sys->p_buffers )
- {
- msg_Err( p_demux, "Out of memory" );
goto open_failed;
- }
p_sys->p_buffers[0].length = i_buffer_size;
p_sys->p_buffers[0].start = malloc( i_buffer_size );
if( !p_sys->p_buffers[0].start )
- {
- msg_Err( p_demux, "Out of memory" );
goto open_failed;
- }
return VLC_SUCCESS;
*/
p_vcddev = (vcddev_t *)malloc( sizeof(vcddev_t) );
if( p_vcddev == NULL )
- {
- msg_Err( p_this, "out of memory" );
return NULL;
- }
p_vcddev->i_vcdimage_handle = -1;
p_vcddev->psz_dev = NULL;
b_is_file = 1;
{
*pp_sectors = malloc( (i_tracks + 1) * sizeof(int) );
if( *pp_sectors == NULL )
- {
- msg_Err( p_this, "out of memory" );
return 0;
- }
memcpy( *pp_sectors, p_vcddev->p_sectors,
(i_tracks + 1) * sizeof(int) );
}
*pp_sectors = malloc( (i_tracks + 1) * sizeof(int) );
if( *pp_sectors == NULL )
{
- msg_Err( p_this, "out of memory" );
darwin_freeTOC( pTOC );
return 0;
}
{
free( *pp_sectors );
free( p_fulltoc );
- msg_Err( p_this, "out of memory" );
CloseHandle( hEvent );
return 0;
}
*pp_sectors = malloc( (i_tracks + 1) * sizeof(int) );
if( *pp_sectors == NULL )
- {
- msg_Err( p_this, "out of memory" );
return 0;
- }
for( i = 0 ; i <= i_tracks ; i++ )
{
*pp_sectors = malloc( (i_tracks + 1) * sizeof(int) );
if( *pp_sectors == NULL )
- {
- msg_Err( p_this, "out of memory" );
return 0;
- }
toc_entries.address_format = CD_LBA_FORMAT;
toc_entries.starting_track = 0;
malloc( toc_entries.data_len );
if( toc_entries.data == NULL )
{
- msg_Err( p_this, "out of memory" );
free( *pp_sectors );
return 0;
}
*pp_sectors = malloc( (i_tracks + 1) * sizeof(int) );
if( *pp_sectors == NULL )
- {
- msg_Err( p_this, "out of memory" );
return 0;
- }
/* Fill the p_sectors structure with the track/sector matches */
for( i = 0 ; i <= i_tracks ; i++ )
/* Allocate the memory needed to store the module's structure */
p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) );
if ( p_filter->p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
- return VLC_EGENERIC;
- }
+ return VLC_ENOMEM;
p_filter->p_sys->i_left = -1;
p_filter->p_sys->i_center = -1;
p_filter->p_sys->i_right = -1;
p_data->p_atomic_operations = malloc( sizeof(struct atomic_operation_t)
* p_data->i_nb_atomic_operations );
if( p_data->p_atomic_operations == NULL )
- {
- msg_Err( p_this, "out of memory" );
return -1;
- }
/* For each virtual speaker, computes elementary wave propagation time
* to each ear */
}
p_data->p_overflow_buffer = malloc( p_data->i_overflow_buffer_size );
if( p_data->p_atomic_operations == NULL )
- {
- msg_Err( p_this, "out of memory" );
return -1;
- }
memset( p_data->p_overflow_buffer, 0 , p_data->i_overflow_buffer_size );
/* end */
/* Allocate the memory needed to store the module's structure */
p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) );
if( p_filter->p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
- return VLC_EGENERIC;
- }
+ return VLC_ENOMEM;
p_filter->p_sys->i_overflow_buffer_size = 0;
p_filter->p_sys->p_overflow_buffer = NULL;
p_filter->p_sys->i_nb_atomic_operations = 0;
/* Allocate the memory needed to store the module's structure */
p_filter->p_sys = malloc( sizeof(struct filter_sys_t) );
if( p_filter->p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
- return VLC_EGENERIC;
- }
+ return VLC_ENOMEM;
p_filter->p_sys->i_overflow_buffer_size = 0;
p_filter->p_sys->p_overflow_buffer = NULL;
p_filter->p_sys->i_nb_atomic_operations = 0;
p_data->p_atomic_operations = malloc( sizeof(struct atomic_operation_t)
* p_data->i_nb_atomic_operations );
if( p_data->p_atomic_operations == NULL )
- {
- msg_Err( p_this, "out of memory" );
return -1;
- }
/* For each virtual speaker, computes elementary wave propagation time
* to each ear */
}
p_data->p_overflow_buffer = malloc( p_data->i_overflow_buffer_size );
if( p_data->p_atomic_operations == NULL )
- {
- msg_Err( p_this, "out of memory" );
return -1;
- }
memset( p_data->p_overflow_buffer, 0, p_data->i_overflow_buffer_size );
/* end */
/* Allocate the memory needed to store the module's structure */
p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) );
if( p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
return VLC_EGENERIC;
- }
var_Create( p_this, MONO_CFG "downmix",
VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
p_sys = malloc( sizeof(filter_sys_t) );
p_filter->p_sys = (struct aout_filter_sys_t *)p_sys;
if( p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
return -1;
- }
i_ret = Open( VLC_OBJECT(p_filter), p_sys,
p_filter->input, p_filter->output );
/* 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;
- }
+ return VLC_ENOMEM;
i_ret = Open( VLC_OBJECT(p_filter), p_sys,
p_filter->fmt_in.audio, p_filter->fmt_out.audio );
p_sys = malloc( sizeof(filter_sys_t) );
p_filter->p_sys = (struct aout_filter_sys_t *)p_sys;
if( p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
return -1;
- }
i_ret = Open( VLC_OBJECT(p_filter), p_sys,
p_filter->input, p_filter->output );
/* Allocate the memory needed to store the module's structure */
p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) );
if( p_sys == NULL )
- {
- 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;
- }
+ return VLC_ENOMEM;
i_ret = Open( VLC_OBJECT(p_filter), p_sys,
p_filter->fmt_in.audio, p_filter->fmt_out.audio );
/* Allocate the memory needed to store the module's structure */
p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) );
if( p_filter->p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
- }
memset( p_filter->p_sys, 0, sizeof(struct aout_filter_sys_t) );
p_filter->p_sys->p_buf = 0;
p_sys = malloc( sizeof(filter_sys_t) );
p_filter->p_sys = (struct aout_filter_sys_t *)p_sys;
if( p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
return -1;
- }
/* Initialize libmad */
mad_stream_init( &p_sys->mad_stream );
/* Allocate the memory needed to store the module's structure */
p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) );
if( p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
return -1;
- }
p_sys->i_reject_count = 0;
p_filter->pf_audio_filter = Convert;
/* Allocate the memory needed to store the module's structure */
p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) );
if( p_filter->p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
- }
/* Calculate worst case for the length of the filter wing */
d_factor = (double)p_filter->output.i_rate
/* Allocate enough memory to buffer previous samples */
p_filter->p_sys->p_buf = malloc( p_filter->p_sys->i_buf_size );
if( p_filter->p_sys->p_buf == NULL )
- {
- msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
- }
p_filter->p_sys->i_old_wing = 0;
p_filter->pf_do_work = DoWork;
p_sys = malloc( sizeof(filter_sys_t) );
p_filter->p_sys = (struct aout_filter_sys_t *)p_sys;
if( p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
- }
p_sys->p_prev_sample = malloc(
p_filter->input.i_channels * sizeof(int32_t) );
if( p_sys->p_prev_sample == NULL )
- {
- msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
- }
aout_DateInit( &p_sys->end_date, p_filter->output.i_rate );
p_filter->pf_do_work = DoWork;
/* Allocate the memory needed to store the module's structure */
p_filter->p_sys = p_sys = malloc( sizeof(struct filter_sys_t) );
if( p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
- }
p_sys->p_prev_sample = malloc(
p_filter->fmt_in.audio.i_channels * sizeof(int32_t) );
if( p_sys->p_prev_sample == NULL )
{
- msg_Err( p_filter, "out of memory" );
free( p_sys );
return VLC_ENOMEM;
}
/* Allocate structure */
p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) );
if( !p_sys )
- {
- msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
- }
p_sys->p_face = 0;
p_sys->p_library = 0;
p_sys->i_font_size = 0;
free( psz_fontfile );
psz_fontfile = (char *)malloc( PATH_MAX + 1 );
if( !psz_fontfile )
- {
- msg_Err( p_filter, "out of memory" );
goto error;
- }
#ifdef WIN32
GetWindowsDirectory( psz_fontfile, PATH_MAX + 1 );
strcat( psz_fontfile, "\\fonts\\arial.ttf" );
psz_unicode = psz_unicode_orig =
malloc( ( strlen(psz_string) + 1 ) * sizeof(uint32_t) );
if( psz_unicode == NULL )
- {
- msg_Err( p_filter, "out of memory" );
goto error;
- }
#if defined(WORDS_BIGENDIAN)
iconv_handle = vlc_iconv_open( "UCS-4BE", "UTF-8" );
#else
p_fribidi_string = malloc( (i_string_length + 1) * sizeof(uint32_t) );
if( !p_fribidi_string )
- {
- msg_Err( p_filter, "out of memory" );
goto error;
- }
/* Do bidi conversion line-by-line */
while( pos < i_string_length )
/* Calculate relative glyph positions and a bounding box for the
* entire string */
if( !(p_line = NewLine( strlen( psz_string ))) )
- {
- msg_Err( p_filter, "out of memory" );
goto error;
- }
p_lines = p_line;
i_pen_x = i_pen_y = 0;
i_previous = i = 0;
{
psz_line_start = psz_unicode;
if( !(p_next = NewLine( strlen( psz_string ))) )
- {
- msg_Err( p_filter, "out of memory" );
goto error;
- }
p_line->p_next = p_next;
p_line->i_width = line.xMax;
p_line->i_height = face->size->metrics.height >> 6;
! p_new_positions ||
! p_levels )
{
- msg_Err( p_filter, "out of memory" );
free( p_levels );
free( p_old_positions );
free( p_new_positions );
malloc( (k - i_prev + 1) * sizeof( uint32_t ));
if( !psz_unicode )
{
- msg_Err( p_filter, "out of memory" );
if( p_face ) FT_Done_Face( p_face );
free( pp_char_styles );
free( psz_unicode );
{
if( !(p_line = NewLine( i_len - i_prev)) )
{
- msg_Err( p_filter, "out of memory" );
if( p_face ) FT_Done_Face( p_face );
free( pp_char_styles );
free( psz_unicode );
/* Allocate instance and initialize some members */
p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
- {
- msg_Err( p_intf, "out of memory" );
return -1;
- }
psz_mode = var_CreateGetString( p_intf, "logmode" );
if( psz_mode )
// Allocate structure
p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) );
if( !p_sys )
- {
- msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
- }
p_sys->psz_font_name = strdup( DEFAULT_FONT );
p_sys->i_font_opacity = 255;
p_sys->i_font_color = DEFAULT_FONT_COLOR;
int i;
if( !p_media )
- {
- msg_Err( p_vod, "not enough memory" );
return NULL;
- }
memset( p_media, 0, sizeof(vod_media_t) );
p_media->id = p_sys->i_media_id++;
/* Open and read file */
p_buffer = malloc( i_buffer );
- if( p_buffer == NULL ) {
- msg_Err( p_xml, "out of memory" );
+ if( p_buffer == NULL )
return NULL;
- }
while( ( i_size = stream_Read( s, &p_buffer[i_pos], 2048 ) ) == 2048 )
{
p_new = realloc( p_buffer, i_buffer );
if( !p_new )
{
- msg_Err( p_xml, "out of memory" );
free( p_buffer );
return NULL;
}
id = malloc( sizeof( sout_stream_id_t ) );
if( !id )
- {
- msg_Err( p_stream, "out of memory" );
goto error;
- }
memset( id, 0, sizeof(sout_stream_id_t) );
id->id = NULL;
/* Create decoder object */
id->p_decoder = vlc_object_create( p_stream, VLC_OBJECT_DECODER );
if( !id->p_decoder )
- {
- msg_Err( p_stream, "out of memory" );
goto error;
- }
vlc_object_attach( id->p_decoder, p_stream );
id->p_decoder->p_module = NULL;
id->p_decoder->fmt_in = *p_fmt;
/* Create encoder object */
id->p_encoder = vlc_object_create( p_stream, VLC_OBJECT_ENCODER );
if( !id->p_encoder )
- {
- msg_Err( p_stream, "out of memory" );
goto error;
- }
vlc_object_attach( id->p_encoder, p_stream );
id->p_encoder->p_module = NULL;
return id;
- error:
- if( id->p_decoder )
+error:
+ if( id )
{
- vlc_object_detach( id->p_decoder );
- vlc_object_release( id->p_decoder );
- id->p_decoder = NULL;
- }
+ if( id->p_decoder )
+ {
+ vlc_object_detach( id->p_decoder );
+ vlc_object_release( id->p_decoder );
+ id->p_decoder = NULL;
+ }
- if( id->p_encoder )
- {
- vlc_object_detach( id->p_encoder );
- es_format_Clean( &id->p_encoder->fmt_out );
- vlc_object_release( id->p_encoder );
- id->p_encoder = NULL;
- }
+ if( id->p_encoder )
+ {
+ vlc_object_detach( id->p_encoder );
+ es_format_Clean( &id->p_encoder->fmt_out );
+ vlc_object_release( id->p_encoder );
+ id->p_encoder = NULL;
+ }
- free( id );
+ free( id );
+ }
return NULL;
}