diff options
Diffstat (limited to 'src/egl/drivers')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 4 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_drm.c | 7 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_wayland.c | 4 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_x11.c | 8 |
4 files changed, 6 insertions, 17 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index f99bcad3081..4b58c35b46b 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1477,12 +1477,10 @@ _eglBuiltInDriverDRI2(const char *args) (void) args; - dri2_drv = malloc(sizeof *dri2_drv); + dri2_drv = calloc(1, sizeof *dri2_drv); if (!dri2_drv) return NULL; - memset(dri2_drv, 0, sizeof *dri2_drv); - if (!dri2_load(&dri2_drv->base)) { free(dri2_drv); return NULL; diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 9aafb525b93..3e04a6cdcb0 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -96,13 +96,12 @@ dri2_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; @@ -399,12 +398,10 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp) int fd = -1; int i; - dri2_dpy = malloc(sizeof *dri2_dpy); + dri2_dpy = calloc(1, sizeof *dri2_dpy); if (!dri2_dpy) return _eglError(EGL_BAD_ALLOC, "eglInitialize"); - memset(dri2_dpy, 0, sizeof *dri2_dpy); - disp->DriverData = (void *) dri2_dpy; gbm = disp->PlatformDisplay; diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index d291f0ffa40..d9b45f1cec2 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -813,12 +813,10 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp) drv->API.CreateImageKHR = dri2_wayland_create_image_khr; drv->API.Terminate = dri2_terminate; - dri2_dpy = malloc(sizeof *dri2_dpy); + dri2_dpy = calloc(1, sizeof *dri2_dpy); if (!dri2_dpy) return _eglError(EGL_BAD_ALLOC, "eglInitialize"); - memset(dri2_dpy, 0, sizeof *dri2_dpy); - disp->DriverData = (void *) dri2_dpy; if (disp->PlatformDisplay == NULL) { dri2_dpy->wl_dpy = wl_display_connect(NULL); diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index f7dc89dc992..25337741437 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -980,12 +980,10 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp) drv->API.CreateDRMImageMESA = NULL; drv->API.ExportDRMImageMESA = NULL; - dri2_dpy = malloc(sizeof *dri2_dpy); + dri2_dpy = calloc(1, sizeof *dri2_dpy); if (!dri2_dpy) return _eglError(EGL_BAD_ALLOC, "eglInitialize"); - memset(dri2_dpy, 0, sizeof *dri2_dpy); - disp->DriverData = (void *) dri2_dpy; if (disp->PlatformDisplay == NULL) { dri2_dpy->conn = xcb_connect(0, 0); @@ -1056,12 +1054,10 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp) drv->API.PostSubBufferNV = dri2_post_sub_buffer; drv->API.SwapInterval = dri2_swap_interval; - dri2_dpy = malloc(sizeof *dri2_dpy); + dri2_dpy = calloc(1, sizeof *dri2_dpy); if (!dri2_dpy) return _eglError(EGL_BAD_ALLOC, "eglInitialize"); - memset(dri2_dpy, 0, sizeof *dri2_dpy); - disp->DriverData = (void *) dri2_dpy; if (disp->PlatformDisplay == NULL) { dri2_dpy->conn = xcb_connect(0, 0); |