From 3b0f72989b54620df84b199d53366d83c20d8bad Mon Sep 17 00:00:00 2001 From: Luca Stefani Date: Thu, 8 Apr 2021 12:13:22 +0200 Subject: [PATCH] platform-profile: Fix crash if kernel built w/o platform_profile If the kernel is built with platform_profile support, g_file_get_contents() will fail, and we'll likely crash trying to access ->message in the struct. Don't forget to pass the error to g_file_get_contents(). --- src/ppd-driver-platform-profile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ppd-driver-platform-profile.c b/src/ppd-driver-platform-profile.c index 9e20ee8..0919191 100644 --- a/src/ppd-driver-platform-profile.c +++ b/src/ppd-driver-platform-profile.c @@ -101,7 +101,7 @@ read_platform_profile (void) platform_profile_path = ppd_utils_get_sysfs_path (ACPI_PLATFORM_PROFILE_PATH); if (!g_file_get_contents (platform_profile_path, - &new_profile_str, NULL, NULL)) { + &new_profile_str, NULL, &error)) { g_debug ("Failed to get contents for '%s': %s", platform_profile_path, error->message);