From 6eabd93d591efbaddb999df84720995c3c4e64d0 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Thu, 9 Dec 2021 18:06:03 +0200 Subject: [PATCH] clients/simple-damage,simple-shm: Use calloc instead of malloc This avoids some unwarranted errors about conditional jumps or invalid access from ASan as malloc doesn't set the memory to zero. Signed-off-by: Marius Vlad --- clients/simple-damage.c | 2 +- clients/simple-shm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/simple-damage.c b/clients/simple-damage.c index 821b42b5..d171fb32 100644 --- a/clients/simple-damage.c +++ b/clients/simple-damage.c @@ -774,7 +774,7 @@ create_display(int version) { struct display *display; - display = malloc(sizeof *display); + display = zalloc(sizeof *display); if (display == NULL) { fprintf(stderr, "out of memory\n"); exit(1); diff --git a/clients/simple-shm.c b/clients/simple-shm.c index 90892c87..fe3ef240 100644 --- a/clients/simple-shm.c +++ b/clients/simple-shm.c @@ -396,7 +396,7 @@ create_display(void) { struct display *display; - display = malloc(sizeof *display); + display = zalloc(sizeof *display); if (display == NULL) { fprintf(stderr, "out of memory\n"); exit(1);