diff options
author | Simon Ser <[email protected]> | 2022-04-26 09:43:54 +0200 |
---|---|---|
committer | Simon Ser <[email protected]> | 2022-04-28 10:09:50 +0200 |
commit | fc43a84af93cbf3a76207a1e43bda40993f689f0 (patch) | |
tree | 984ea8566f411056c2fa6d459aa4e8c5bea257f0 | |
parent | fcbdeee3bf0e78fd538a27654edaf5497c8892f7 (diff) |
Zero-initialize structs in init functions
Ensures there is no field left to its previous undefined value after
calling an init function.
-rw-r--r-- | wlr_scene.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/wlr_scene.c b/wlr_scene.c index 9353fef..d88dd55 100644 --- a/wlr_scene.c +++ b/wlr_scene.c @@ -48,6 +48,7 @@ static struct wlr_scene *scene_node_get_root(struct wlr_scene_node *node) { } static void scene_node_state_init(struct wlr_scene_node_state *state) { + memset(state, 0, sizeof(*state)); wl_list_init(&state->children); wl_list_init(&state->link); state->enabled = true; @@ -61,6 +62,7 @@ static void scene_node_init(struct wlr_scene_node *node, enum wlr_scene_node_type type, struct wlr_scene_node *parent) { assert(type == WLR_SCENE_NODE_ROOT || parent != NULL); + memset(node, 0, sizeof(*node)); node->type = type; node->parent = parent; scene_node_state_init(&node->state); |