summaryrefslogtreecommitdiff
path: root/src/login/logind-user.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-06-15 12:22:19 +0200
committerLennart Poettering <lennart@poettering.net>2015-06-15 12:22:19 +0200
commitf430b07b72c6cc5aab43ddeba940b59bd0aaecc7 (patch)
tree9dfc35a790810d5df2df739948572d003e461c84 /src/login/logind-user.c
parentcceb20c75ca4eb14cb72866e9490691b543f0dd6 (diff)
parentb9460fdc8b57102b665a662b82efcced4b1af72b (diff)
Merge pull request #180 from ronnychevalier/rc/coverity_cid_1304686
login: fix potential null pointer dereference
Diffstat (limited to 'src/login/logind-user.c')
-rw-r--r--src/login/logind-user.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index c0b473930d..a9cf529e12 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -763,6 +763,9 @@ static int elect_display_compare(Session *s1, Session *s2) {
* is preferred.
*
* s1 or s2 may be NULL. */
+ if (!s1 && !s2)
+ return 0;
+
if ((s1 == NULL) != (s2 == NULL))
return (s1 == NULL) - (s2 == NULL);