]> git.sesse.net Git - vlc/commitdiff
Check most demux_t.p_sys allocations
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 11 Jul 2011 19:28:28 +0000 (22:28 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 11 Jul 2011 19:29:38 +0000 (22:29 +0300)
modules/demux/cdg.c
modules/demux/flac.c
modules/demux/mjpeg.c
modules/demux/nsv.c
modules/demux/pva.c
modules/demux/ty.c
modules/demux/vc1.c
modules/demux/xa.c

index c7a3b6ec7a84fd9298511d08c270e66a5758a388..e0087571357d2d0119c2ee54ae020a062e53e175 100644 (file)
@@ -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 );
index 898943d8429a59bcbce5af19812db59c516c75cb..0f01695333706df529acefac8462336462738db9 100644 (file)
@@ -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) );
index 2ebb4a87701caaa91ec2effc47ab5998101a1743..afdc484d39f26277726ed2cce81ffb57acc5ff84 100644 (file)
@@ -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;
index d81251d23f74e334869f35edfb9434b9393b995d..017f511ce03623a20bc3988fae75ae5eb116dbc2 100644 (file)
@@ -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;
index f62b522339ea1b074e2d51a16675c931f8ab4c87..d25702de7a6b34900b033479fcb8d70693f0b438 100644 (file)
@@ -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 );
index 75e2f3cb3a185b8c054210c1166bb59e595f01de..a9e0d2a54397011303e11c0a1592f400082079aa 100644 (file)
@@ -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) */
index 0370455b3ddbacbe59f4b631f9f45f4845d4c552..bbc82037d74a3250e61f7d724b8b505e9ffb10cf 100644 (file)
@@ -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" );
index a70f45a7c3846439c400c9f4b130473f6a8de590..3e25547da972e615efd429f0962a5419f0fcf896 100644 (file)
@@ -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 */