From 88e7eb3c73ca1cd4a5c1ca3ac779cb617b63d298 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Wed, 15 Jan 2025 17:09:53 +0100 Subject: [PATCH] Properly handle dbus errors when getting hostname --- server/hostname.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/hostname.cpp b/server/hostname.cpp index b3701120..3aa76d7b 100644 --- a/server/hostname.cpp +++ b/server/hostname.cpp @@ -14,6 +14,7 @@ static std::string _hostname() if (!con) { U_LOG_W("Failed to connect to system bus: %s", error->message); + g_error_free(error); } else { @@ -32,7 +33,11 @@ static std::string _hostname() &error); if (error) + { + g_error_free(error); + error = NULL; continue; + } GVariant * property_value; g_variant_get(result, "(v)", &property_value);