[vlc-commits] Swscale: use calloc instead of malloc

Jean-Baptiste Kempf git at videolan.org
Sun Oct 26 01:09:59 CEST 2014


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Oct 26 01:07:16 2014 +0200| [de52f56adc16506c59d535e15396f19b5ad42a5e] | committer: Jean-Baptiste Kempf

Swscale: use calloc instead of malloc

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=de52f56adc16506c59d535e15396f19b5ad42a5e
---

 modules/video_chroma/swscale.c |   11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/modules/video_chroma/swscale.c b/modules/video_chroma/swscale.c
index 1d10b9d..f432194 100644
--- a/modules/video_chroma/swscale.c
+++ b/modules/video_chroma/swscale.c
@@ -155,7 +155,7 @@ static int OpenScaler( vlc_object_t *p_this )
     /* */
     p_filter->pf_video_filter = Filter;
     /* Allocate the memory needed to store the decoder's structure */
-    if( ( p_filter->p_sys = p_sys = malloc(sizeof(filter_sys_t)) ) == NULL )
+    if( ( p_filter->p_sys = p_sys = calloc(1, sizeof(filter_sys_t)) ) == NULL )
         return VLC_ENOMEM;
 
     /* Set CPU capabilities */
@@ -179,16 +179,7 @@ static int OpenScaler( vlc_object_t *p_this )
     default: p_sys->i_sws_flags = SWS_BICUBIC; i_sws_mode = 2; break;
     }
 
-    p_sys->p_src_filter = NULL;
-    p_sys->p_dst_filter = NULL;
-
     /* Misc init */
-    p_sys->ctx = NULL;
-    p_sys->ctxA = NULL;
-    p_sys->p_src_a = NULL;
-    p_sys->p_dst_a = NULL;
-    p_sys->p_src_e = NULL;
-    p_sys->p_dst_e = NULL;
     memset( &p_sys->fmt_in,  0, sizeof(p_sys->fmt_in) );
     memset( &p_sys->fmt_out, 0, sizeof(p_sys->fmt_out) );
 



More information about the vlc-commits mailing list