diff options
author | Simon Ser <contact@emersion.fr> | 2022-04-26 09:43:54 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-04-28 10:09:50 +0200 |
commit | 6c350799b22ddc5cb89467c95692437bbf0116b9 (patch) | |
tree | 4559c68cb117d9c044e79fb0fbb7453042538375 /backend | |
parent | 54653b5d95935e379e26db5518456a66384b5405 (diff) |
Zero-initialize structs in init functions
Ensures there is no field left to its previous undefined value after
calling an init function.
Diffstat (limited to 'backend')
-rw-r--r-- | backend/backend.c | 2 | ||||
-rw-r--r-- | backend/drm/drm.c | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/backend/backend.c b/backend/backend.c index bfb43ba0..ac6e2165 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -36,7 +36,7 @@ void wlr_backend_init(struct wlr_backend *backend, const struct wlr_backend_impl *impl) { - assert(backend); + memset(backend, 0, sizeof(*backend)); backend->impl = impl; wl_signal_init(&backend->events.destroy); wl_signal_init(&backend->events.new_input); diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 2b573295..5a828426 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -380,6 +380,7 @@ static bool drm_crtc_page_flip(struct wlr_drm_connector *conn, static void drm_connector_state_init(struct wlr_drm_connector_state *state, struct wlr_drm_connector *conn, const struct wlr_output_state *base) { + memset(state, 0, sizeof(*state)); state->base = base; state->modeset = base->committed & (WLR_OUTPUT_STATE_ENABLED | WLR_OUTPUT_STATE_MODE); |