Commit 1ce28bdd authored by Jean-Paul Saman's avatar Jean-Paul Saman

demux/avformat/demux.c: Check malloc return values.

parent d481fd45
......@@ -212,6 +212,11 @@ int OpenDemux( vlc_object_t *p_this )
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
if( !p_sys )
{
free( psz_url );
return VLC_ENOMEM;
}
p_sys->ic = 0;
p_sys->fmt = fmt;
p_sys->i_tk = 0;
......@@ -224,7 +229,12 @@ int OpenDemux( vlc_object_t *p_this )
/* Create I/O wrapper */
p_sys->io_buffer_size = 32768; /* FIXME */
p_sys->io_buffer = malloc( p_sys->io_buffer_size );
if( !p_sys->io_buffer )
{
free( psz_url );
CloseDemux( p_this );
return VLC_ENOMEM;
}
#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(2<<8)+0)
p_sys->ic = avformat_alloc_context();
p_sys->ic->pb = avio_alloc_context( p_sys->io_buffer,
......@@ -321,6 +331,7 @@ int OpenDemux( vlc_object_t *p_this )
if( cc->palctrl )
{
fmt.video.p_palette = malloc( sizeof(video_palette_t) );
if( fmt.video.p_palette )
*fmt.video.p_palette = *(video_palette_t *)cc->palctrl;
}
#else
......
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