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 <marius.vlad@collabora.com>
dev
Marius Vlad 3 years ago
parent f676a8f54e
commit 6eabd93d59
  1. 2
      clients/simple-damage.c
  2. 2
      clients/simple-shm.c

@ -774,7 +774,7 @@ create_display(int version)
{ {
struct display *display; struct display *display;
display = malloc(sizeof *display); display = zalloc(sizeof *display);
if (display == NULL) { if (display == NULL) {
fprintf(stderr, "out of memory\n"); fprintf(stderr, "out of memory\n");
exit(1); exit(1);

@ -396,7 +396,7 @@ create_display(void)
{ {
struct display *display; struct display *display;
display = malloc(sizeof *display); display = zalloc(sizeof *display);
if (display == NULL) { if (display == NULL) {
fprintf(stderr, "out of memory\n"); fprintf(stderr, "out of memory\n");
exit(1); exit(1);

Loading…
Cancel
Save