Commit 1cdbc7b6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Check most demux_t.p_sys allocations

parent c1f0e3ce
......@@ -86,9 +86,13 @@ static int Open( vlc_object_t * p_this )
// return VLC_EGENERIC;
// }
p_sys = malloc( sizeof( demux_sys_t ) );
if( unlikely(p_sys == NULL) )
return VLC_ENOMEM;
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
p_demux->p_sys = p_sys;
/* */
es_format_Init( &p_sys->fmt, VIDEO_ES, VLC_CODEC_CDG );
......
......@@ -119,9 +119,13 @@ static int Open( vlc_object_t * p_this )
"continuing anyway" );
}
p_sys = malloc( sizeof( demux_sys_t ) );
if( unlikely(p_sys == NULL) )
return VLC_ENOMEM;
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
p_demux->p_sys = p_sys;
p_sys->b_start = true;
p_sys->p_meta = NULL;
memset( &p_sys->replay_gain, 0, sizeof(p_sys->replay_gain) );
......
......@@ -303,8 +303,12 @@ static int Open( vlc_object_t * p_this )
bool b_matched = false;
float f_fps;
p_sys = malloc( sizeof( demux_sys_t ) );
if( unlikely(p_sys == NULL) )
return VLC_ENOMEM;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
p_demux->p_sys = p_sys;
p_sys->p_es = NULL;
p_sys->i_time = 0;
p_sys->i_level = 0;
......
......@@ -104,10 +104,14 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC;
}
p_sys = malloc( sizeof( demux_sys_t ) );
if( unlikely(p_sys == NULL) )
return VLC_ENOMEM;
/* Fill p_demux field */
p_demux->p_sys = p_sys;
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
es_format_Init( &p_sys->fmt_audio, AUDIO_ES, 0 );
p_sys->p_audio = NULL;
......
......@@ -92,10 +92,14 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC;
}
p_sys = malloc( sizeof( demux_sys_t ) );
if( unlikely(p_sys == NULL) )
return VLC_ENOMEM;
/* Fill p_demux field */
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
p_demux->p_sys = p_sys;
/* Register one audio and one video stream */
es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_MPGA );
......
......@@ -318,12 +318,16 @@ static int Open(vlc_object_t *p_this)
/* at this point, we assume we have a valid TY stream */
msg_Dbg( p_demux, "valid TY stream detected" );
p_sys = malloc(sizeof(demux_sys_t));
if( unlikely(p_sys == NULL) )
return VLC_ENOMEM;
/* Set exported functions */
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
/* create our structure that will hold all data */
p_demux->p_sys = p_sys = malloc(sizeof(demux_sys_t));
p_demux->p_sys = p_sys;
memset(p_sys, 0, sizeof(demux_sys_t));
/* set up our struct (most were zero'd out with the memset above) */
......
......@@ -96,9 +96,13 @@ static int Open( vlc_object_t * p_this )
"continuing anyway" );
}
p_sys = malloc( sizeof( demux_sys_t ) );
if( unlikely(p_sys == NULL) )
return VLC_ENOMEM;
p_demux->pf_demux = Demux;
p_demux->pf_control= Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
p_demux->p_sys = p_sys;
p_sys->p_es = NULL;
p_sys->i_dts = 0;
p_sys->f_fps = var_CreateGetFloat( p_demux, "vc1-fps" );
......
......@@ -100,9 +100,13 @@ static int Open( vlc_object_t * p_this )
|| ( GetWLE( &p_xa.wBitsPerSample ) != 16) )
return VLC_EGENERIC;
p_sys = malloc( sizeof( demux_sys_t ) );
if( unlikely( p_sys == NULL ) )
return VLC_ENOMEM;
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
p_demux->p_sys = p_sys;
p_sys->p_es = NULL;
/* skip XA header -- cannot fail */
......
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