[gdm] gdm-x-session: initialize local pointers to NULL



commit c486068f1b32d6ba57c97f044a7c8e4a556ab8bf
Author: Ray Strode <rstrode redhat com>
Date:   Fri Feb 20 10:20:34 2015 -0500

    gdm-x-session: initialize local pointers to NULL
    
    We follow the "goto out" idiom for error handling, and so
    it's important that pointers cleaned up at out time, are
    initialized.
    
    This commit does a sweep and nullifies them across the board.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744787

 daemon/gdm-x-session.c |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/daemon/gdm-x-session.c b/daemon/gdm-x-session.c
index e97cfff..b6bfe83 100644
--- a/daemon/gdm-x-session.c
+++ b/daemon/gdm-x-session.c
@@ -195,11 +195,11 @@ spawn_x_server (State        *state,
                 gboolean      allow_remote_connections,
                 GCancellable *cancellable)
 {
-        GPtrArray           *arguments;
-        GSubprocessLauncher *launcher;
-        GSubprocess         *subprocess;
-        GInputStream        *input_stream;
-        GDataInputStream    *data_stream;
+        GPtrArray           *arguments = NULL;
+        GSubprocessLauncher *launcher = NULL;
+        GSubprocess         *subprocess = NULL;
+        GInputStream        *input_stream = NULL;
+        GDataInputStream    *data_stream = NULL;
         GError              *error = NULL;
 
         char     *auth_file;
@@ -363,14 +363,14 @@ static gboolean
 spawn_bus (State        *state,
            GCancellable *cancellable)
 {
-        GPtrArray           *arguments;
-        GSubprocessLauncher *launcher;
-        GSubprocess         *subprocess;
-        GInputStream        *input_stream;
-        GDataInputStream    *data_stream;
+        GPtrArray           *arguments = NULL;
+        GSubprocessLauncher *launcher = NULL;
+        GSubprocess         *subprocess = NULL;
+        GInputStream        *input_stream = NULL;
+        GDataInputStream    *data_stream = NULL;
         GError              *error = NULL;
         char                *bus_address_fd_string;
-        char                *bus_address;
+        char                *bus_address = NULL;
         gsize                bus_address_size;
 
         gboolean  is_running = FALSE;
@@ -489,8 +489,8 @@ spawn_session (State        *state,
                gboolean      run_script,
                GCancellable *cancellable)
 {
-        GSubprocessLauncher *launcher;
-        GSubprocess         *subprocess;
+        GSubprocessLauncher *launcher = NULL;
+        GSubprocess         *subprocess = NULL;
         GError              *error = NULL;
         gboolean             is_running = FALSE;
         const char          *vt;
@@ -588,7 +588,7 @@ static gboolean
 register_display (State        *state,
                   GCancellable *cancellable)
 {
-        GdmDBusManager  *manager;
+        GdmDBusManager  *manager = NULL;
         GError          *error = NULL;
         gboolean         registered = FALSE;
         GVariantBuilder  details;
@@ -663,8 +663,8 @@ int
 main (int    argc,
       char **argv)
 {
-        State           *state;
-        GOptionContext  *context;
+        State           *state = NULL;
+        GOptionContext  *context = NULL;
         static char    **args = NULL;
         static gboolean  run_script = FALSE;
         static gboolean  allow_remote_connections = FALSE;


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