Skip to content

Commit c397015

Browse files
committed
GPU (Linux): fix memleaks
1 parent 66aee54 commit c397015

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/detection/gpu/gpu_linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus)
7878
//https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-pci
7979
const char* pciDirPath = "/sys/bus/pci/devices/";
8080

81-
DIR* dirp = opendir(pciDirPath);
81+
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(pciDirPath);
8282
if(dirp == NULL)
8383
return "Failed to open `/sys/bus/pci/devices/`";
8484

src/modules/physicaldisk/physicaldisk.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ void ffPrintPhysicalDisk(FFPhysicalDiskOptions* options)
130130
ffStrbufDestroy(&dev->interconnect);
131131
ffStrbufDestroy(&dev->devPath);
132132
ffStrbufDestroy(&dev->serial);
133+
ffStrbufDestroy(&dev->revision);
133134
}
134135
}
135136

@@ -244,6 +245,8 @@ void ffGeneratePhysicalDiskJsonResult(FFPhysicalDiskOptions* options, yyjson_mut
244245
ffStrbufDestroy(&dev->name);
245246
ffStrbufDestroy(&dev->interconnect);
246247
ffStrbufDestroy(&dev->devPath);
248+
ffStrbufDestroy(&dev->serial);
249+
ffStrbufDestroy(&dev->revision);
247250
}
248251
}
249252

0 commit comments

Comments
 (0)