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




commit 896beb4eb8bca3dd6042d519ca3bae5118f7135d
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

 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]