[vlc-commits] Check most demux_t.p_sys allocations
Rémi Denis-Courmont
git at videolan.org
Mon Jul 11 21:38:10 CEST 2011
vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jul 11 22:28:28 2011 +0300| [f38f9dbc6a4b783b2d6cf1867846d2fc641e6e9f] | committer: Rémi Denis-Courmont
Check most demux_t.p_sys allocations
(cherry picked from commit 1cdbc7b6f2294024815f3d28128c8a7bf21156cb)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=f38f9dbc6a4b783b2d6cf1867846d2fc641e6e9f
---
modules/demux/cdg.c | 6 +++++-
modules/demux/flac.c | 6 +++++-
modules/demux/mjpeg.c | 6 +++++-
modules/demux/nsv.c | 6 +++++-
modules/demux/pva.c | 6 +++++-
modules/demux/ty.c | 6 +++++-
modules/demux/vc1.c | 6 +++++-
modules/demux/xa.c | 6 +++++-
8 files changed, 40 insertions(+), 8 deletions(-)
diff --git a/modules/demux/cdg.c b/modules/demux/cdg.c
index 6cc401f..ef9125e 100644
--- a/modules/demux/cdg.c
+++ b/modules/demux/cdg.c
@@ -89,9 +89,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 );
diff --git a/modules/demux/flac.c b/modules/demux/flac.c
index f402e27..9ce415b 100644
--- a/modules/demux/flac.c
+++ b/modules/demux/flac.c
@@ -118,9 +118,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) );
diff --git a/modules/demux/mjpeg.c b/modules/demux/mjpeg.c
index 9867a4b..240126b 100644
--- a/modules/demux/mjpeg.c
+++ b/modules/demux/mjpeg.c
@@ -305,8 +305,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;
diff --git a/modules/demux/nsv.c b/modules/demux/nsv.c
index d81251d..017f511 100644
--- a/modules/demux/nsv.c
+++ b/modules/demux/nsv.c
@@ -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;
diff --git a/modules/demux/pva.c b/modules/demux/pva.c
index b02f8dd..01865d9 100644
--- a/modules/demux/pva.c
+++ b/modules/demux/pva.c
@@ -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 );
diff --git a/modules/demux/ty.c b/modules/demux/ty.c
index 9c27d97..431c6c7 100644
--- a/modules/demux/ty.c
+++ b/modules/demux/ty.c
@@ -319,12 +319,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) */
diff --git a/modules/demux/vc1.c b/modules/demux/vc1.c
index f01ffa3..2e53edc 100644
--- a/modules/demux/vc1.c
+++ b/modules/demux/vc1.c
@@ -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" );
diff --git a/modules/demux/xa.c b/modules/demux/xa.c
index 65b0c97..9b4bcb3 100644
--- a/modules/demux/xa.c
+++ b/modules/demux/xa.c
@@ -102,9 +102,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 */
More information about the vlc-commits
mailing list