[mutter/wip/carlosg/fix-the-fix] x11: Initialize struct early




commit ab45ae18ffa81b5a1456c039b47023ceb641b9d9
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Oct 27 14:10:28 2021 +0200

    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>

 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 95f4f68e73..5b4879bc00 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]