Skip to content

Commit 4f42d38

Browse files
committed
GPU (FreeBSD): fix mem leaks
1 parent 7b22434 commit 4f42d38

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/detection/gpu/gpu_bsd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ static const char* detectByDrm(const FFGPUOptions* options, FFlist* gpus)
4545
{
4646
FF_LIBRARY_LOAD(libdrm, "dlopen libdrm" FF_LIBRARY_EXTENSION " failed", "libdrm" FF_LIBRARY_EXTENSION, 2)
4747
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmGetDevices)
48+
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libdrm, drmFreeDevices)
4849

4950
drmDevicePtr devices[64];
5051
int nDevices = ffdrmGetDevices(devices, ARRAY_SIZE(devices));
52+
if (nDevices < 0)
53+
return "drmGetDevices() failed";
5154

5255
for (int iDev = 0; iDev < nDevices; ++iDev)
5356
{
@@ -136,6 +139,8 @@ static const char* detectByDrm(const FFGPUOptions* options, FFlist* gpus)
136139
fillGPUTypeGeneric(gpu);
137140
}
138141

142+
ffdrmFreeDevices(devices, nDevices);
143+
139144
return NULL;
140145
}
141146
#endif

0 commit comments

Comments
 (0)