Commit 3059bd8f authored by Rémi Duraffort's avatar Rémi Duraffort

Check malloc return value.

parent 70db1cf5
...@@ -299,12 +299,15 @@ static int ReadMeta( vlc_object_t *p_this ) ...@@ -299,12 +299,15 @@ static int ReadMeta( vlc_object_t *p_this )
* terminated string */ * terminated string */
char *psz_ufid = (char*) malloc( 64 ); char *psz_ufid = (char*) malloc( 64 );
int j = 0; int j = 0;
while( ( j < 63 ) && if( psz_ufid )
( j < p_ufid->identifier().size() ) ) {
psz_ufid[j] = p_ufid->identifier()[j++]; while( ( j < 63 ) &&
psz_ufid[j] = '\0'; ( j < p_ufid->identifier().size() ) )
vlc_meta_SetTrackID( p_meta, psz_ufid ); psz_ufid[j] = p_ufid->identifier()[j++];
free( psz_ufid ); psz_ufid[j] = '\0';
vlc_meta_SetTrackID( p_meta, psz_ufid );
free( psz_ufid );
}
} }
} }
......
...@@ -201,6 +201,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -201,6 +201,8 @@ static int Open( vlc_object_t *p_this )
p_mux->pf_mux = Mux; p_mux->pf_mux = Mux;
p_mux->p_sys = p_sys = malloc( sizeof( sout_mux_sys_t ) ); p_mux->p_sys = p_sys = malloc( sizeof( sout_mux_sys_t ) );
if( !p_sys )
return VLC_ENOMEM;
p_sys->b_asf_http = p_mux->psz_mux && !strcmp( p_mux->psz_mux, "asfh" ); p_sys->b_asf_http = p_mux->psz_mux && !strcmp( p_mux->psz_mux, "asfh" );
if( p_sys->b_asf_http ) if( p_sys->b_asf_http )
{ {
...@@ -449,6 +451,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -449,6 +451,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
tk->i_extra = sizeof( WAVEFORMATEX ) + tk->i_extra = sizeof( WAVEFORMATEX ) +
p_input->p_fmt->i_extra + i_extra; p_input->p_fmt->i_extra + i_extra;
tk->p_extra = malloc( tk->i_extra ); tk->p_extra = malloc( tk->i_extra );
if( !tk->p_extra )
return VLC_ENOMEM;
bo_init( &bo, tk->p_extra, tk->i_extra ); bo_init( &bo, tk->p_extra, tk->i_extra );
bo_addle_u16( &bo, tk->i_tag ); bo_addle_u16( &bo, tk->i_tag );
bo_addle_u16( &bo, p_input->p_fmt->audio.i_channels ); bo_addle_u16( &bo, p_input->p_fmt->audio.i_channels );
...@@ -506,6 +510,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -506,6 +510,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
tk->i_extra = 11 + sizeof( BITMAPINFOHEADER ) + tk->i_extra = 11 + sizeof( BITMAPINFOHEADER ) +
p_input->p_fmt->i_extra; p_input->p_fmt->i_extra;
tk->p_extra = malloc( tk->i_extra ); tk->p_extra = malloc( tk->i_extra );
if( !tk->p_extra )
return VLC_ENOMEM;
bo_init( &bo, tk->p_extra, tk->i_extra ); bo_init( &bo, tk->p_extra, tk->i_extra );
bo_addle_u32( &bo, p_input->p_fmt->video.i_width ); bo_addle_u32( &bo, p_input->p_fmt->video.i_width );
bo_addle_u32( &bo, p_input->p_fmt->video.i_height ); bo_addle_u32( &bo, p_input->p_fmt->video.i_height );
......
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