[vlc-devel] [RFC 22/38] packetizer/mpeg4video: use calloc instead	of malloc+memset
    Filip Roséen 
    filip at videolabs.io
       
    Mon Jun 27 13:43:33 CEST 2016
    
    
  
---
 modules/packetizer/mpeg4video.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/modules/packetizer/mpeg4video.c b/modules/packetizer/mpeg4video.c
index e1ce505..a8767d5 100644
--- a/modules/packetizer/mpeg4video.c
+++ b/modules/packetizer/mpeg4video.c
@@ -137,9 +137,8 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     /* Allocate the memory needed to store the decoder's structure */
-    if( ( p_dec->p_sys = p_sys = malloc( sizeof(decoder_sys_t) ) ) == NULL )
+    if( ( p_dec->p_sys = p_sys = calloc( 1, sizeof(decoder_sys_t) ) ) == NULL )
         return VLC_ENOMEM;
-    memset( p_sys, 0, sizeof(decoder_sys_t) );
 
     /* Misc init */
     packetizer_Init( &p_sys->packetizer,
-- 
2.9.0
    
    
More information about the vlc-devel
mailing list