From 1449290e9e4f7abb34e71ca70c220718d7d1d9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 3 May 2024 08:28:20 +0800 Subject: [PATCH] GPU (Linux): check NULL returned by opendir Fix #845 --- src/detection/gpu/gpu_linux.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/detection/gpu/gpu_linux.c b/src/detection/gpu/gpu_linux.c index a8801cb31..65566cb8a 100644 --- a/src/detection/gpu/gpu_linux.c +++ b/src/detection/gpu/gpu_linux.c @@ -46,6 +46,8 @@ static void pciDetectAmdSpecific(const FFGPUOptions* options, FFGPUResult* gpu, ffStrbufAppendS(pciDir, "/hwmon/"); FF_AUTO_CLOSE_DIR DIR* dirp = opendir(pciDir->chars); + if (!dirp) return; + struct dirent* entry; while ((entry = readdir(dirp)) != NULL) {