os-support: systemd-logind: don't hard-crash Xserver on strdup() fail

No need to directly hard-crash the Xserver when strdup() fails, instead
try to handle the situation gracefully.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-03-03 15:31:19 +01:00
parent a17e8bda4d
commit 1035323b36

View File

@ -492,7 +492,11 @@ connect_hook(DBusConnection *connection, void *data)
error.message);
goto cleanup;
}
session = XNFstrdup(session);
session = strdup(session);
if (!session) {
LogMessage(X_ERROR, "systemd-logind: out of memory\n");
goto cleanup;
}
dbus_message_unref(reply);
reply = NULL;