[gdm/wip/import-user-env: 4/5] gdm-{wayland, x}-session: fix segfault if run with no arguments



commit 2208dba0ac9329e0844c8288ccf3f01094e5e305
Author: Ray Strode <rstrode redhat com>
Date:   Thu Aug 25 14:40:09 2016 -0400

    gdm-{wayland,x}-session: fix segfault if run with no arguments
    
    Right now we crash on clean up paths if the programs are invoked wrong.
    
    This commit fixes that.

 daemon/gdm-wayland-session.c |    8 +++++---
 daemon/gdm-x-session.c       |    8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/daemon/gdm-wayland-session.c b/daemon/gdm-wayland-session.c
index 149eb8a..449803b 100644
--- a/daemon/gdm-wayland-session.c
+++ b/daemon/gdm-wayland-session.c
@@ -472,9 +472,11 @@ main (int    argc,
         }
 
 out:
-        signal_subprocesses (state);
-        wait_on_subprocesses (state);
-        clear_state (&state);
+        if (state != NULL) {
+                signal_subprocesses (state);
+                wait_on_subprocesses (state);
+                clear_state (&state);
+        }
 
         return exit_status;
 }
diff --git a/daemon/gdm-x-session.c b/daemon/gdm-x-session.c
index d0a00ca..b4f34cd 100644
--- a/daemon/gdm-x-session.c
+++ b/daemon/gdm-x-session.c
@@ -850,9 +850,11 @@ main (int    argc,
         }
 
 out:
-        signal_subprocesses (state);
-        wait_on_subprocesses (state);
-        clear_state (&state);
+        if (state != NULL) {
+                signal_subprocesses (state);
+                wait_on_subprocesses (state);
+                clear_state (&state);
+        }
 
         return exit_status;
 }


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