Check allocation and initialise memory
authorRafaël Carré <funman@videolan.org>
Tue, 20 May 2008 13:06:24 +0000 (15:06 +0200)
committerRafaël Carré <funman@videolan.org>
Tue, 20 May 2008 13:16:28 +0000 (15:16 +0200)
modules/packetizer/mpegvideo.c

index 168ae51..a0443dd 100644 (file)
@@ -164,6 +164,9 @@ static int Open( vlc_object_t *p_this )
     p_dec->pf_get_cc = GetCc;
 
     p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
+    if( !p_dec->p_sys )
+        return VLC_ENOMEM;
+    memset( p_dec->p_sys, 0, sizeof( decoder_sys_t ) );
 
     /* Misc init */
     p_sys->i_state = STATE_NOSYNC;