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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2063>
This commit is contained in:
Carlos Garnacho 2021-10-27 14:10:28 +02:00
parent 774d7b46a8
commit ab45ae18ff

View File

@ -1102,6 +1102,9 @@ load_state (const char *previous_save_file)
gsize length; gsize length;
char *session_file; char *session_file;
parse_data.info = NULL;
parse_data.previous_id = NULL;
session_file = g_strconcat (g_get_user_config_dir (), session_file = g_strconcat (g_get_user_config_dir (),
G_DIR_SEPARATOR_S "mutter" G_DIR_SEPARATOR_S "mutter"
G_DIR_SEPARATOR_S "sessions" G_DIR_SEPARATOR_S, G_DIR_SEPARATOR_S "sessions" G_DIR_SEPARATOR_S,
@ -1122,9 +1125,6 @@ load_state (const char *previous_save_file)
g_free (session_file); g_free (session_file);
session_file = NULL; session_file = NULL;
parse_data.info = NULL;
parse_data.previous_id = NULL;
context = g_markup_parse_context_new (&mutter_session_parser, context = g_markup_parse_context_new (&mutter_session_parser,
0, &parse_data, NULL); 0, &parse_data, NULL);