Fix two potential segfaults.
Cosmetics.
p_input = malloc(sizeof(aout_input_t));
if ( p_input == NULL )
- {
- msg_Err( p_aout, "out of memory" );
goto error;
- }
memset( p_input, 0, sizeof(aout_input_t) );
vlc_mutex_init( &p_input->lock );
* 1000000 / p_filter->input.i_rate,
*pp_input_buffer, p_output_buffer );
if ( p_output_buffer == NULL )
- {
- msg_Err( p_aout, "out of memory" );
return;
- }
/* Please note that p_output_buffer->i_nb_samples & i_nb_bytes
* shall be set by the filter plug-in. */
p_output_buffer );
if ( p_output_buffer == NULL )
{
- msg_Err( p_aout, "out of memory" );
vlc_mutex_unlock( &p_aout->input_fifos_lock );
return -1;
}
p_dec = vlc_object_create( p_input, i_object_type );
if( p_dec == NULL )
- {
- msg_Err( p_input, "out of memory" );
return NULL;
- }
p_dec->pf_decode_audio = 0;
p_dec->pf_decode_video = 0;
/* Allocate our private structure for the decoder */
p_dec->p_owner = p_owner = malloc( sizeof( decoder_owner_sys_t ) );
if( p_dec->p_owner == NULL )
- {
- msg_Err( p_dec, "out of memory" );
return NULL;
- }
p_dec->p_owner->b_own_thread = true;
p_dec->p_owner->i_preroll_end = -1;
p_dec->p_owner->p_input = p_input;
/* decoder fifo */
if( ( p_dec->p_owner->p_fifo = block_FifoNew() ) == NULL )
- {
- msg_Err( p_dec, "out of memory" );
return NULL;
- }
/* Set buffers allocation callbacks for the decoders */
p_dec->pf_aout_buffer_new = aout_new_buffer;
{
decoder_synchro_t * p_synchro = malloc( sizeof(*p_synchro) );
if ( p_synchro == NULL )
- {
- msg_Err( p_dec, "out of memory" );
return NULL;
- }
memset( p_synchro, 0, sizeof(*p_synchro) );
p_synchro->p_dec = p_dec;
if( psz_demux == NULL || *psz_demux == '\0' ) return NULL;
s = vlc_stream_create( p_obj );
+ if( s == NULL )
+ return NULL;
s->pf_read = DStreamRead;
s->pf_peek = DStreamPeek;
s->pf_control= DStreamControl;
s->b_little_endian = false;
s->p_sys = malloc( sizeof( d_stream_sys_t) );
+ if( s->p_sys == NULL )
+ {
+ vlc_object_release( s );
+ return NULL;
+ }
p_sys = (d_stream_sys_t*)s->p_sys;
p_sys->i_pos = 0;
/* decoder fifo */
if( ( p_sys->p_fifo = block_FifoNew() ) == NULL )
{
- msg_Err( s, "out of memory" );
vlc_object_release( s );
+ free( p_sys->psz_name );
free( p_sys );
return NULL;
}
p_input = vlc_custom_create( p_parent, sizeof( *p_input ),
VLC_OBJECT_INPUT, input_name );
if( p_input == NULL )
- {
- msg_Err( p_parent, "out of memory" );
return NULL;
- }
/* Construct a nice name for the input timer */
char psz_timer_name[255];
s->p_sys = p_sys = malloc( sizeof( stream_sys_t ) );
if( p_sys == NULL )
- {
- msg_Err( s, "Out of memory when allocating stream_sys_t" );
goto error;
- }
/* UTF16 and UTF32 text file conversion */
s->i_char_width = 1;
{
access_entry_t *p_entry = malloc( sizeof(access_entry_t) );
if( p_entry == NULL )
- {
- msg_Err( s, "Out of memory when allocating access_entry_t" );
goto error;
- }
char *psz_name, *psz_parser = psz_name = psz_list;
p_sys->p_list_access = p_access;
p_entry->psz_path = strdup( p_access->psz_path );
if( p_entry->psz_path == NULL )
{
- msg_Err( s, "Out of memory when duplicating p_access->psz_path" );
free( p_entry );
goto error;
}
p_entry = malloc( sizeof(access_entry_t) );
if( p_entry == NULL )
- {
- msg_Err( p_access, "Out of memory when allocating access_entry_t" );
goto error;
- }
p_entry->i_size = p_tmp->info.i_size;
p_entry->psz_path = psz_name;
TAB_APPEND( p_sys->i_list, p_sys->list, p_entry );
i_data = (psz_eol - (char *)p_data) + 1;
p_line = realloc( p_line, i_line + i_data + s->i_char_width ); /* add \0 */
if( !p_line )
- {
- msg_Err( s, "Out of memory when reallocating p_line" );
goto error;
- }
i_data = stream_Read( s, &p_line[i_line], i_data );
if( i_data <= 0 ) break; /* Hmmm */
i_line += i_data - s->i_char_width; /* skip \n */;
/* Read data (+1 for easy \0 append) */
p_line = realloc( p_line, i_line + STREAM_PROBE_LINE + s->i_char_width );
if( !p_line )
- {
- msg_Err( s, "Out of memory when reallocating p_line" );
goto error;
- }
i_data = stream_Read( s, &p_line[i_line], STREAM_PROBE_LINE );
if( i_data <= 0 ) break; /* Hmmm */
i_line += i_data;
/* iconv */
psz_new_line = malloc( i_line );
if( psz_new_line == NULL )
- {
- msg_Err( s, "Out of memory when allocating psz_new_line" );
goto error;
- }
i_in = i_out = (size_t)i_line;
p_in = p_line;
p_out = psz_new_line;
p_media = malloc( sizeof( vlm_media_sys_t ) );
if( !p_media )
- {
- msg_Err( p_vlm, "out of memory" );
return VLC_ENOMEM;
- }
memset( p_media, 0, sizeof(vlm_media_sys_t) );
if( p_cfg->b_vod )
/* Allocate structure */
p_intf = vlc_object_create( p_this, VLC_OBJECT_INTF );
if( !p_intf )
- {
- msg_Err( p_this, "out of memory" );
return NULL;
- }
p_intf->pf_request_window = NULL;
p_intf->pf_release_window = NULL;
p_intf->pf_control_window = NULL;
if ( !dbus_message_iter_append_basic( &dbus_args,
DBUS_TYPE_STRING, &ppsz_argv[i_input] ) )
{
- msg_Err( p_libvlc, "Out of memory" );
dbus_message_unref( p_dbus_msg );
system_End( p_libvlc );
exit( VLC_ENOMEM );
if ( !dbus_message_iter_append_basic( &dbus_args,
DBUS_TYPE_BOOLEAN, &b_play ) )
{
- msg_Err( p_libvlc, "Out of memory" );
dbus_message_unref( p_dbus_msg );
system_End( p_libvlc );
exit( VLC_ENOMEM );
/* Allocate structure */
p_probe = vlc_object_create( p_this, VLC_OBJECT_INTF );
if( !p_probe )
- {
- msg_Err( p_this, "out of memory" );
return;
- }
p_probe->p_module = module_Need( p_probe, "devices probe", "", false );
if( p_probe->p_module == NULL )
{
sizeof(vlc_event_listener_t)*i_cached_listeners );
if( !array_of_cached_listeners )
{
- msg_Err( p_em->p_parent_object, "Not enough memory in vlc_event_send" );
vlc_mutex_unlock( &p_em->object_lock );
return;
}
p_dec = vlc_object_create( p_this, VLC_OBJECT_DECODER );
if( p_dec == NULL )
- {
- msg_Err( p_this, "out of memory" );
return NULL;
- }
p_dec->p_module = NULL;
es_format_Init( &p_dec->fmt_in, VIDEO_ES, fmt->i_chroma );
p_enc = vlc_object_create( p_this, VLC_OBJECT_ENCODER );
if( p_enc == NULL )
- {
- msg_Err( p_this, "out of memory" );
return NULL;
- }
p_enc->p_module = NULL;
es_format_Init( &p_enc->fmt_in, VIDEO_ES, fmt_in->i_chroma );
update_download_thread_t *p_udt = vlc_object_create( p_update->p_libvlc,
sizeof( update_download_thread_t ) );
if( !p_udt )
- {
- msg_Err( p_update->p_libvlc, "out of memory" );
return;
- }
p_udt->p_update = p_update;
p_udt->psz_destdir = psz_destdir ? strdup( psz_destdir ) : NULL;
p_module = vlc_module_create( p_this );
if( p_module == NULL )
{
- msg_Err( p_this, "out of memory" );
module_Unload( handle );
return NULL;
}
* allocate a structure for it */
p_module = vlc_module_create( p_this );
if( p_module == NULL )
- {
- msg_Err( p_this, "out of memory" );
return -1;
- }
/* Initialize the module : fill p_module->psz_object_name, etc. */
if( pf_entry( p_module ) != 0 )
psz_host = strdup( psz_hostname );
if( psz_host == NULL )
- {
- msg_Err( p_this, "memory error" );
return NULL;
- }
/* to be sure to avoid multiple creation */
var_Create( p_this->p_libvlc, "httpd_mutex", VLC_VAR_MUTEX );
p_menu = vlc_custom_create( p_this, sizeof( *p_menu ), VLC_OBJECT_OSDMENU,
osdmenu_name );
if( !p_menu )
- {
- msg_Err( p_this, "out of memory" );
return NULL;
- }
vlc_object_yield( p_menu );
vlc_object_attach( p_menu, p_this->p_libvlc );
p_playlist = vlc_custom_create( p_parent, sizeof( *p_playlist ),
VLC_OBJECT_GENERIC, playlist_name );
if( !p_playlist )
- {
- msg_Err( p_parent, "out of memory" );
return NULL;
- }
TAB_INIT( p_playlist->i_sds, p_playlist->pp_sds );
/* Prepare the playlist_export_t structure */
p_export = (playlist_export_t *)malloc( sizeof(playlist_export_t) );
if( !p_export)
- {
- msg_Err( p_playlist, "out of memory" );
return VLC_ENOMEM;
- }
p_export->psz_filename = NULL;
if ( psz_filename )
p_export->psz_filename = strdup( psz_filename );
/* Free in playlist_ServicesDiscoveryRemove */
p_sds = malloc( sizeof(struct playlist_services_discovery_support_t) );
if( !p_sds )
- {
- msg_Err( p_playlist, "No more memory" );
return VLC_ENOMEM;
- }
p_sds->p_sd = p_sd;
p_sds->p_one = p_one;
p_sds->p_cat = p_cat;
p_announce = vlc_object_create( p_this, VLC_OBJECT_ANNOUNCE );
if( !p_announce )
- {
- msg_Err( p_this, "out of memory" );
return NULL;
- }
p_announce->p_sap = NULL;
vlc_object_attach( p_announce, p_this->p_libvlc);
p_sap = vlc_custom_create( VLC_OBJECT(p_announce), sizeof( sap_handler_t ),
VLC_OBJECT_ANNOUNCE, "announce" );
if( !p_sap )
- {
- msg_Err( p_announce, "out of memory" );
return NULL;
- }
p_sap->psz_object_name = strdup( "sap announcer" );
if( !( p_access = vlc_object_create( p_sout,
sizeof( sout_access_out_t ) ) ) )
- {
- msg_Err( p_sout, "out of memory" );
return NULL;
- }
psz_next = config_ChainCreate( &p_access->psz_access, &p_access->p_cfg,
psz_access );
free( psz_next );
p_access->psz_path = strdup( psz_name ? psz_name : "" );
p_access->p_sout = p_sout;
- p_access->p_sys = NULL;
+ p_access->p_sys = NULL;
p_access->pf_seek = NULL;
p_access->pf_read = NULL;
p_access->pf_write = NULL;
p_mux = vlc_object_create( p_sout, sizeof( sout_mux_t ) );
if( p_mux == NULL )
- {
- msg_Err( p_sout, "out of memory" );
return NULL;
- }
p_mux->p_sout = p_sout;
psz_next = config_ChainCreate( &p_mux->psz_mux, &p_mux->p_cfg, psz_mux );
/* create a new sout input */
p_input = malloc( sizeof( sout_input_t ) );
if( !p_input )
- {
- msg_Err( p_mux, "out of memory" );
return NULL;
- }
p_input->p_sout = p_mux->p_sout;
p_input->p_fmt = p_fmt;
p_input->p_fifo = block_FifoNew();
p_stream = vlc_object_create( p_sout, sizeof( sout_stream_t ) );
if( !p_stream )
- {
- msg_Err( p_sout, "out of memory" );
return NULL;
- }
p_stream->p_sout = p_sout;
p_stream->p_sys = NULL;
if( vlc_thread_create( p_vout, "video output", RunThread,
VLC_THREAD_PRIORITY_OUTPUT, true ) )
{
- msg_Err( p_vout, "out of memory" );
module_Unneed( p_vout, p_vout->p_module );
vlc_object_release( p_vout );
return NULL;