mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-06 01:41:07 -05:00
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>
This commit is contained in:
parent
4b05ecb8f7
commit
5eb5620cbd
5 changed files with 14 additions and 14 deletions
|
|
@ -568,10 +568,10 @@ wl_closure_init(const struct wl_message *message, uint32_t size,
|
|||
|
||||
if (size) {
|
||||
*num_arrays = wl_message_count_arrays(message);
|
||||
closure = malloc(sizeof *closure + size +
|
||||
closure = zalloc(sizeof *closure + size +
|
||||
*num_arrays * sizeof(struct wl_array));
|
||||
} else {
|
||||
closure = malloc(sizeof *closure);
|
||||
closure = zalloc(sizeof *closure);
|
||||
}
|
||||
|
||||
if (!closure) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue