summaryrefslogtreecommitdiffstats
path: root/src/wayland-shm.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-01-31 22:23:30 +0100
committerSimon Ser <contact@emersion.fr>2022-02-05 14:25:19 +0000
commit5eb5620cbd317aac4a61e357c3c92bd889d6079b (patch)
tree5a3953e2ff74d9ef9ad4e7d32dca9da750b80689 /src/wayland-shm.c
parentbuild: explicitly set check arg in run_command() (diff)
downloadwayland-5eb5620cbd317aac4a61e357c3c92bd889d6079b.tar
wayland-5eb5620cbd317aac4a61e357c3c92bd889d6079b.tar.gz
wayland-5eb5620cbd317aac4a61e357c3c92bd889d6079b.tar.bz2
wayland-5eb5620cbd317aac4a61e357c3c92bd889d6079b.tar.lz
wayland-5eb5620cbd317aac4a61e357c3c92bd889d6079b.tar.xz
wayland-5eb5620cbd317aac4a61e357c3c92bd889d6079b.tar.zst
wayland-5eb5620cbd317aac4a61e357c3c92bd889d6079b.zip
Use zalloc for structs
When allocating memory for structs, use zalloc instead of malloc. This ensures the memory is zero-initialized, and reduces the risk of forgetting to initialize all struct fields. Signed-off-by: Simon Ser <contact@emersion.fr>
Diffstat (limited to 'src/wayland-shm.c')
-rw-r--r--src/wayland-shm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wayland-shm.c b/src/wayland-shm.c
index 63ac0d7..28c550d 100644
--- a/src/wayland-shm.c
+++ b/src/wayland-shm.c
@@ -223,7 +223,7 @@ shm_pool_create_buffer(struct wl_client *client, struct wl_resource *resource,
return;
}
- buffer = malloc(sizeof *buffer);
+ buffer = zalloc(sizeof *buffer);
if (buffer == NULL) {
wl_client_post_no_memory(client);
return;
@@ -312,7 +312,7 @@ shm_create_pool(struct wl_client *client, struct wl_resource *resource,
goto err_close;
}
- pool = malloc(sizeof *pool);
+ pool = zalloc(sizeof *pool);
if (pool == NULL) {
wl_client_post_no_memory(client);
goto err_close;