GPU (Linux): fix memleaks

This commit is contained in:
李通洲
2024-03-01 10:41:42 +08:00
parent 66aee54401
commit c3970154d6
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus)
//https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-pci
const char* pciDirPath = "/sys/bus/pci/devices/";
DIR* dirp = opendir(pciDirPath);
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(pciDirPath);
if(dirp == NULL)
return "Failed to open `/sys/bus/pci/devices/`";
+3
View File
@@ -130,6 +130,7 @@ void ffPrintPhysicalDisk(FFPhysicalDiskOptions* options)
ffStrbufDestroy(&dev->interconnect);
ffStrbufDestroy(&dev->devPath);
ffStrbufDestroy(&dev->serial);
ffStrbufDestroy(&dev->revision);
}
}
@@ -244,6 +245,8 @@ void ffGeneratePhysicalDiskJsonResult(FFPhysicalDiskOptions* options, yyjson_mut
ffStrbufDestroy(&dev->name);
ffStrbufDestroy(&dev->interconnect);
ffStrbufDestroy(&dev->devPath);
ffStrbufDestroy(&dev->serial);
ffStrbufDestroy(&dev->revision);
}
}