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

Check most demux_t.p_sys allocations

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