Signed-off-by: Bryce Harrington <br...@osg.samsung.com>
---
 clients/desktop-shell.c            | 3 ++-
 clients/fullscreen.c               | 7 ++++++-
 clients/ivi-shell-user-interface.c | 3 ++-
 clients/multi-resource.c           | 3 ++-
 clients/presentation-shm.c         | 7 ++++---
 clients/simple-damage.c            | 3 ++-
 clients/simple-dmabuf-intel.c      | 3 ++-
 clients/simple-dmabuf-v4l.c        | 3 ++-
 clients/simple-shm.c               | 3 ++-
 clients/subsurfaces.c              | 3 ++-
 clients/weston-info.c              | 3 ++-
 clients/window.c                   | 3 ++-
 12 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 6ab76dc..49a3077 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -46,6 +46,7 @@
 #include "shared/cairo-util.h"
 #include "shared/config-parser.h"
 #include "shared/helpers.h"
+#include "shared/zalloc.h"
 
 #include "weston-desktop-shell-client-protocol.h"
 
@@ -1203,7 +1204,7 @@ create_output(struct desktop *desktop, uint32_t id)
 {
        struct output *output;
 
-       output = calloc(1, sizeof *output);
+       output = zalloc(sizeof *output);
        if (!output)
                return;
 
diff --git a/clients/fullscreen.c b/clients/fullscreen.c
index 653372a..e2e6477 100644
--- a/clients/fullscreen.c
+++ b/clients/fullscreen.c
@@ -36,6 +36,7 @@
 #include <wayland-client.h>
 #include "window.h"
 #include "fullscreen-shell-unstable-v1-client-protocol.h"
+#include "shared/zalloc.h"
 
 struct fs_output {
        struct wl_list link;
@@ -460,7 +461,11 @@ output_handler(struct output *output, void *data)
                if (fsout->output == output)
                        return;
 
-       fsout = calloc(1, sizeof *fsout);
+       fsout = zalloc(sizeof *fsout);
+       if (fsout == NULL) {
+               fprintf(stderr, "out of memory in output_handler\n");
+               return;
+       }
        fsout->output = output;
        wl_list_insert(&fullscreen->output_list, &fsout->link);
 }
diff --git a/clients/ivi-shell-user-interface.c 
b/clients/ivi-shell-user-interface.c
index 2e0622b..1349c73 100644
--- a/clients/ivi-shell-user-interface.c
+++ b/clients/ivi-shell-user-interface.c
@@ -40,6 +40,7 @@
 #include "shared/config-parser.h"
 #include "shared/helpers.h"
 #include "shared/os-compatibility.h"
+#include "shared/zalloc.h"
 #include "ivi-application-client-protocol.h"
 #include "ivi-hmi-controller-client-protocol.h"
 
@@ -177,7 +178,7 @@ fail_on_null(void *p, size_t size, char *file, int32_t line)
 static void *
 mem_alloc(size_t size, char *file, int32_t line)
 {
-       return fail_on_null(calloc(1, size), size, file, line);
+       return fail_on_null(zalloc(size), size, file, line);
 }
 
 #define MEM_ALLOC(s) mem_alloc((s),__FILE__,__LINE__)
diff --git a/clients/multi-resource.c b/clients/multi-resource.c
index c30d38a..4ed4d50 100644
--- a/clients/multi-resource.c
+++ b/clients/multi-resource.c
@@ -40,6 +40,7 @@
 
 #include <wayland-client.h>
 #include "shared/os-compatibility.h"
+#include "shared/zalloc.h"
 
 struct device {
        enum { KEYBOARD, POINTER } type;
@@ -87,7 +88,7 @@ xzalloc(size_t s)
 {
        void *p;
 
-       p = calloc(1, s);
+       p = zalloc(s);
        if (p == NULL) {
                fprintf(stderr, "%s: out of memory\n", 
program_invocation_short_name);
                exit(EXIT_FAILURE);
diff --git a/clients/presentation-shm.c b/clients/presentation-shm.c
index 120c40c..ee662d6 100644
--- a/clients/presentation-shm.c
+++ b/clients/presentation-shm.c
@@ -37,6 +37,7 @@
 
 #include <wayland-client.h>
 #include "shared/helpers.h"
+#include "shared/zalloc.h"
 #include "shared/os-compatibility.h"
 #include "presentation_timing-client-protocol.h"
 
@@ -212,7 +213,7 @@ create_window(struct display *display, int width, int 
height,
                 "presentation-shm: %s [Delay %i msecs]", run_mode_name[mode],
                 commit_delay_msecs);
 
-       window = calloc(1, sizeof *window);
+       window = zalloc(sizeof *window);
        if (!window)
                return NULL;
 
@@ -500,7 +501,7 @@ window_create_feedback(struct window *window, uint32_t 
frame_stamp)
        if (!pres)
                return;
 
-       feedback = calloc(1, sizeof *feedback);
+       feedback = zalloc(sizeof *feedback);
        if (!feedback)
                return;
 
@@ -677,7 +678,7 @@ display_add_output(struct display *d, uint32_t name, 
uint32_t version)
 {
        struct output *o;
 
-       o = calloc(1, sizeof(*o));
+       o = zalloc(sizeof(*o));
        assert(o);
 
        o->output = wl_registry_bind(d->registry, name,
diff --git a/clients/simple-damage.c b/clients/simple-damage.c
index 0353ccc..321b90f 100644
--- a/clients/simple-damage.c
+++ b/clients/simple-damage.c
@@ -37,6 +37,7 @@
 
 #include <wayland-client.h>
 #include "shared/os-compatibility.h"
+#include "shared/zalloc.h"
 #include "xdg-shell-unstable-v5-client-protocol.h"
 #include "fullscreen-shell-unstable-v1-client-protocol.h"
 #include "scaler-client-protocol.h"
@@ -271,7 +272,7 @@ create_window(struct display *display, int width, int 
height,
                exit(1);
        }
 
-       window = calloc(1, sizeof *window);
+       window = zalloc(sizeof *window);
        if (!window)
                return NULL;
 
diff --git a/clients/simple-dmabuf-intel.c b/clients/simple-dmabuf-intel.c
index 0ceefeb..2ac2200 100644
--- a/clients/simple-dmabuf-intel.c
+++ b/clients/simple-dmabuf-intel.c
@@ -40,6 +40,7 @@
 #include <drm_fourcc.h>
 
 #include <wayland-client.h>
+#include "shared/zalloc.h"
 #include "xdg-shell-unstable-v5-client-protocol.h"
 #include "fullscreen-shell-unstable-v1-client-protocol.h"
 #include "linux-dmabuf-unstable-v1-client-protocol.h"
@@ -310,7 +311,7 @@ create_window(struct display *display, int width, int 
height)
        int i;
        int ret;
 
-       window = calloc(1, sizeof *window);
+       window = zalloc(sizeof *window);
        if (!window)
                return NULL;
 
diff --git a/clients/simple-dmabuf-v4l.c b/clients/simple-dmabuf-v4l.c
index 29e41ac..a73556c 100644
--- a/clients/simple-dmabuf-v4l.c
+++ b/clients/simple-dmabuf-v4l.c
@@ -42,6 +42,7 @@
 #include <linux/input.h>
 
 #include <wayland-client.h>
+#include "shared/zalloc.h"
 #include "xdg-shell-unstable-v5-client-protocol.h"
 #include "fullscreen-shell-unstable-v1-client-protocol.h"
 #include "linux-dmabuf-unstable-v1-client-protocol.h"
@@ -544,7 +545,7 @@ create_window(struct display *display)
 {
        struct window *window;
 
-       window = calloc(1, sizeof *window);
+       window = zalloc(sizeof *window);
        if (!window)
                return NULL;
 
diff --git a/clients/simple-shm.c b/clients/simple-shm.c
index e6f0bd0..6d8f608 100644
--- a/clients/simple-shm.c
+++ b/clients/simple-shm.c
@@ -35,6 +35,7 @@
 
 #include <wayland-client.h>
 #include "shared/os-compatibility.h"
+#include "shared/zalloc.h"
 #include "xdg-shell-unstable-v5-client-protocol.h"
 #include "fullscreen-shell-unstable-v1-client-protocol.h"
 
@@ -157,7 +158,7 @@ create_window(struct display *display, int width, int 
height)
 {
        struct window *window;
 
-       window = calloc(1, sizeof *window);
+       window = zalloc(sizeof *window);
        if (!window)
                return NULL;
 
diff --git a/clients/subsurfaces.c b/clients/subsurfaces.c
index b971fdf..bf0b96b 100644
--- a/clients/subsurfaces.c
+++ b/clients/subsurfaces.c
@@ -42,6 +42,7 @@
 #include <EGL/eglext.h>
 
 #include "shared/helpers.h"
+#include "shared/zalloc.h"
 #include "window.h"
 
 #if 0
@@ -215,7 +216,7 @@ egl_state_create(struct wl_display *display)
        EGLint major, minor, n;
        EGLBoolean ret;
 
-       egl = calloc(1, sizeof *egl);
+       egl = zalloc(sizeof *egl);
        assert(egl);
 
        egl->dpy =
diff --git a/clients/weston-info.c b/clients/weston-info.c
index 49d64fe..e1529df 100644
--- a/clients/weston-info.c
+++ b/clients/weston-info.c
@@ -34,6 +34,7 @@
 
 #include "shared/helpers.h"
 #include "shared/os-compatibility.h"
+#include "shared/zalloc.h"
 #include "presentation_timing-client-protocol.h"
 
 typedef void (*print_info_t)(void *info);
@@ -138,7 +139,7 @@ xmalloc(size_t s)
 static void *
 xzalloc(size_t s)
 {
-       return fail_on_null(calloc(1, s));
+       return fail_on_null(zalloc(s));
 }
 
 static char *
diff --git a/clients/window.c b/clients/window.c
index 35261b6..ced867e 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -68,6 +68,7 @@ typedef void *EGLContext;
 #include <wayland-client.h>
 #include "shared/cairo-util.h"
 #include "shared/helpers.h"
+#include "shared/zalloc.h"
 #include "xdg-shell-unstable-v5-client-protocol.h"
 #include "text-cursor-position-client-protocol.h"
 #include "shared/os-compatibility.h"
@@ -629,7 +630,7 @@ egl_window_surface_create(struct display *display,
        if (display->dpy == EGL_NO_DISPLAY)
                return NULL;
 
-       surface = calloc(1, sizeof *surface);
+       surface = zalloc(sizeof *surface);
        if (!surface)
                return NULL;
 
-- 
1.9.1

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to