Mesa (master): Use calloc instead of malloc/memset-0

Matt Turner mattst88 at kemper.freedesktop.org
Tue Dec 9 01:02:15 UTC 2014


Module: Mesa
Branch: master
Commit: f0a8bcd84e50468a703a0ac366a4e067610df30c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0a8bcd84e50468a703a0ac366a4e067610df30c

Author: Matt Turner <mattst88 at gmail.com>
Date:   Sun Sep 21 21:15:26 2014 -0700

Use calloc instead of malloc/memset-0

See commit 6bda027e for the Coccinelle script.

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/egl/drivers/dri2/platform_wayland.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 59b2792..ba0eb10 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -130,13 +130,12 @@ dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
 
    (void) drv;
 
-   dri2_surf = malloc(sizeof *dri2_surf);
+   dri2_surf = calloc(1, sizeof *dri2_surf);
    if (!dri2_surf) {
       _eglError(EGL_BAD_ALLOC, "dri2_create_surface");
       return NULL;
    }
    
-   memset(dri2_surf, 0, sizeof *dri2_surf);
    if (!_eglInitSurface(&dri2_surf->base, disp, type, conf, attrib_list))
       goto cleanup_surf;
 




More information about the mesa-commit mailing list