diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c index b6e95cefc0..49d7f6c998 100644 --- a/src/lib/ecore_wayland/ecore_wl.c +++ b/src/lib/ecore_wayland/ecore_wl.c @@ -162,14 +162,12 @@ ecore_wl_init(const char *name) ECORE_WL_EVENT_INTERFACES_BOUND = ecore_event_type_new(); } - if (!(_ecore_wl_disp = malloc(sizeof(Ecore_Wl_Display)))) + if (!(_ecore_wl_disp = calloc(1, sizeof(Ecore_Wl_Display)))) { ERR("Could not allocate memory for Ecore_Wl_Display structure"); goto exit_ecore_disp; } - memset(_ecore_wl_disp, 0, sizeof(Ecore_Wl_Display)); - if (!(_ecore_wl_disp->wl.display = wl_display_connect(name))) { ERR("Could not connect to Wayland display"); diff --git a/src/lib/ecore_wayland/ecore_wl_output.c b/src/lib/ecore_wayland/ecore_wl_output.c index 28c430f4aa..412611b2d8 100644 --- a/src/lib/ecore_wayland/ecore_wl_output.c +++ b/src/lib/ecore_wayland/ecore_wl_output.c @@ -73,9 +73,7 @@ _ecore_wl_output_add(Ecore_Wl_Display *ewd, unsigned int id) LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!(output = malloc(sizeof(Ecore_Wl_Output)))) return; - - memset(output, 0, sizeof(Ecore_Wl_Output)); + if (!(output = calloc(1, sizeof(Ecore_Wl_Output)))) return; output->display = ewd; diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c index 05f38321e4..8f2f192ebe 100644 --- a/src/lib/ecore_wayland/ecore_wl_window.c +++ b/src/lib/ecore_wayland/ecore_wl_window.c @@ -74,14 +74,12 @@ ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buf LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!(win = malloc(sizeof(Ecore_Wl_Window)))) + if (!(win = calloc(1, sizeof(Ecore_Wl_Window)))) { ERR("Failed to allocate an Ecore Wayland Window"); return NULL; } - memset(win, 0, sizeof(Ecore_Wl_Window)); - win->display = _ecore_wl_disp; win->parent = parent; win->allocation.x = x;