From ab45ae18ffa81b5a1456c039b47023ceb641b9d9 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 27 Oct 2021 14:10:28 +0200 Subject: [PATCH] x11: Initialize struct early Since we now use the common error paths, this could fallback at a point where it was trying to free uninitialized memory. CID: #1508193 Part-of: --- src/x11/session.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/x11/session.c b/src/x11/session.c index 95f4f68e7..5b4879bc0 100644 --- a/src/x11/session.c +++ b/src/x11/session.c @@ -1102,6 +1102,9 @@ load_state (const char *previous_save_file) gsize length; char *session_file; + parse_data.info = NULL; + parse_data.previous_id = NULL; + session_file = g_strconcat (g_get_user_config_dir (), G_DIR_SEPARATOR_S "mutter" G_DIR_SEPARATOR_S "sessions" G_DIR_SEPARATOR_S, @@ -1122,9 +1125,6 @@ load_state (const char *previous_save_file) g_free (session_file); session_file = NULL; - parse_data.info = NULL; - parse_data.previous_id = NULL; - context = g_markup_parse_context_new (&mutter_session_parser, 0, &parse_data, NULL);