From 6862747c484e42ae8cc8caa02647d243dfe5502f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 26 Jul 2024 08:45:38 +0800 Subject: [PATCH] GPU (macOS): fix possible segfault when detecting GPU frequency (M1 Air) Fix #1122 --- src/detection/gpu/gpu_apple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detection/gpu/gpu_apple.c b/src/detection/gpu/gpu_apple.c index c63974d1f..be74022c0 100644 --- a/src/detection/gpu/gpu_apple.c +++ b/src/detection/gpu/gpu_apple.c @@ -53,7 +53,7 @@ static const char* detectFrequency(FFGPUResult* gpu) return "\"pmgr\" should conform to \"AppleARMIODevice\""; FF_CFTYPE_AUTO_RELEASE CFDataRef freqProperty = (CFDataRef) IORegistryEntryCreateCFProperty(entryDevice, CFSTR("voltage-states9-sram"), kCFAllocatorDefault, kNilOptions); - if (CFGetTypeID(freqProperty) != CFDataGetTypeID()) + if (!freqProperty || CFGetTypeID(freqProperty) != CFDataGetTypeID()) return "\"voltage-states9-sram\" in \"pmgr\" is not found"; // voltage-states5-sram stores supported pairs of gpu from the lowest to the highest