Commit 2f2c70a8 authored by Jean-Paul Saman's avatar Jean-Paul Saman Committed by Jean-Paul Saman

Check malloc return values.

parent c245c80a
...@@ -858,6 +858,11 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -858,6 +858,11 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
sout_stream_id_t *id; sout_stream_id_t *id;
id = malloc( sizeof( sout_stream_id_t ) ); 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) ); memset( id, 0, sizeof(sout_stream_id_t) );
id->id = NULL; id->id = NULL;
...@@ -2482,6 +2487,7 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring, ...@@ -2482,6 +2487,7 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring,
} }
p_pic = malloc( sizeof(picture_t) ); p_pic = malloc( sizeof(picture_t) );
if( !p_pic ) return NULL;
p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec; p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
vout_AllocatePicture( VLC_OBJECT(p_dec), p_pic, vout_AllocatePicture( VLC_OBJECT(p_dec), p_pic,
p_dec->fmt_out.video.i_chroma, p_dec->fmt_out.video.i_chroma,
...@@ -2492,11 +2498,16 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring, ...@@ -2492,11 +2498,16 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring,
if( !p_pic->i_planes ) if( !p_pic->i_planes )
{ {
free( p_pic ); free( p_pic );
return 0; return NULL;
} }
p_pic->pf_release = video_release_buffer; p_pic->pf_release = video_release_buffer;
p_pic->p_sys = malloc( sizeof(picture_sys_t) ); p_pic->p_sys = malloc( sizeof(picture_sys_t) );
if( !p_pic->p_sys )
{
free( p_pic );
return NULL;
}
p_pic->p_sys->p_owner = p_this; p_pic->p_sys->p_owner = p_this;
p_pic->i_status = RESERVED_PICTURE; p_pic->i_status = RESERVED_PICTURE;
......
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