From a6c006221d21d8db370f1e29c1fbd27c65e888bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 23 Jun 2024 09:03:32 +0800 Subject: [PATCH] GPU (AMD): fix use-after-free crashes Ref: https://github.com/fastfetch-cli/fastfetch/issues/1032 --- src/detection/gpu/gpu_amd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/detection/gpu/gpu_amd.c b/src/detection/gpu/gpu_amd.c index 0b367acca..8df677f65 100644 --- a/src/detection/gpu/gpu_amd.c +++ b/src/detection/gpu/gpu_amd.c @@ -19,13 +19,12 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu inited = true; FF_LIBRARY_LOAD(libags, NULL, "dlopen amd_ags failed", soName , 1); FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libags, agsInitialize) - FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libags, agsDeInitialize) struct AGSContext* apiHandle; if (ffagsInitialize(AGS_CURRENT_VERSION, NULL, &apiHandle, &gpuInfo) != AGS_SUCCESS) return "loading ags library failed"; - ffagsDeInitialize(apiHandle); + // agsDeInitialize will free pointers allocated in gpuInfo. Just leak them. } if (gpuInfo.numDevices == 0)