From 1035323b368df534b08b9ae2fb38043c3f87dc87 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 3 Mar 2025 15:31:19 +0100 Subject: [PATCH] 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 --- hw/xfree86/os-support/linux/systemd-logind.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c index 97f8902e9..a2e358180 100644 --- a/hw/xfree86/os-support/linux/systemd-logind.c +++ b/hw/xfree86/os-support/linux/systemd-logind.c @@ -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;