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 )
sout_stream_id_t *id;
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;
......@@ -2129,11 +2134,11 @@ static int transcode_video_process( sout_stream_t *p_stream,
/* Check if we need a filter for chroma conversion or resizing */
if( id->p_decoder->fmt_out.video.i_chroma !=
id->p_encoder->fmt_in.video.i_chroma ||
(int)id->p_decoder->fmt_out.video.i_width != p_sys->i_crop_width ||
p_sys->i_crop_width != p_sys->i_nopadd_width ||
p_sys->i_nopadd_width != (int)id->p_encoder->fmt_out.video.i_width ||
(int)id->p_decoder->fmt_out.video.i_height != p_sys->i_crop_height ||
p_sys->i_crop_height != p_sys->i_nopadd_height ||
p_sys->i_nopadd_height != (int)id->p_encoder->fmt_out.video.i_height)
......@@ -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) );
if( !p_pic ) return NULL;
p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
vout_AllocatePicture( VLC_OBJECT(p_dec), p_pic,
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,
if( !p_pic->i_planes )
{
free( p_pic );
return 0;
return NULL;
}
p_pic->pf_release = video_release_buffer;
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->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