1
mirror of https://code.videolan.org/videolan/vlc synced 2024-08-27 04:21:53 +02:00

vlc_input: remove unneeded init and add check allocs

This commit is contained in:
Francois Cartegnie 2015-11-21 20:35:13 +01:00
parent e1aaa1e07b
commit 0efef5cc76

View File

@ -71,8 +71,11 @@ static inline void vlc_seekpoint_Delete( seekpoint_t *point )
static inline seekpoint_t *vlc_seekpoint_Duplicate( const seekpoint_t *src )
{
seekpoint_t *point = vlc_seekpoint_New();
if( src->psz_name ) point->psz_name = strdup( src->psz_name );
point->i_time_offset = src->i_time_offset;
if( likely(point) )
{
if( src->psz_name ) point->psz_name = strdup( src->psz_name );
point->i_time_offset = src->i_time_offset;
}
return point;
}
@ -115,10 +118,7 @@ static inline void vlc_input_title_Delete( input_title_t *t )
free( t->psz_name );
for( i = 0; i < t->i_seekpoint; i++ )
{
free( t->seekpoint[i]->psz_name );
free( t->seekpoint[i] );
}
vlc_seekpoint_Delete( t->seekpoint[i] );
free( t->seekpoint );
free( t );
}
@ -131,15 +131,14 @@ static inline input_title_t *vlc_input_title_Duplicate( const input_title_t *t )
if( t->psz_name ) dup->psz_name = strdup( t->psz_name );
dup->b_menu = t->b_menu;
dup->i_length = t->i_length;
dup->i_seekpoint = t->i_seekpoint;
if( t->i_seekpoint > 0 )
{
dup->seekpoint = (seekpoint_t**)calloc( t->i_seekpoint,
sizeof(seekpoint_t*) );
for( i = 0; i < t->i_seekpoint; i++ )
dup->seekpoint = (seekpoint_t**)malloc( t->i_seekpoint * sizeof(seekpoint_t*) );
if( likely(dup->seekpoint) )
{
dup->seekpoint[i] = vlc_seekpoint_Duplicate( t->seekpoint[i] );
for( i = 0; i < t->i_seekpoint; i++ )
dup->seekpoint[i] = vlc_seekpoint_Duplicate( t->seekpoint[i] );
dup->i_seekpoint = t->i_seekpoint;
}
}