mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-25 11:50:17 +01:00
drm: fix drmFreeDevices memory leak on multi GPU setups
When in multi GPU case, devices array may have some NULL "hole" in between two devices. So check all array elements and free non-NULL device. Signed-off-by: Qiang Yu <Qiang.Yu@amd.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
parent
3c20893daa
commit
6c056eecd5
1 changed files with 3 additions and 2 deletions
|
|
@ -2993,8 +2993,9 @@ void drmFreeDevices(drmDevicePtr devices[], int count)
|
|||
if (devices == NULL)
|
||||
return;
|
||||
|
||||
for (i = 0; i < count && devices[i] != NULL; i++)
|
||||
drmFreeDevice(&devices[i]);
|
||||
for (i = 0; i < count; i++)
|
||||
if (devices[i])
|
||||
drmFreeDevice(&devices[i]);
|
||||
}
|
||||
|
||||
static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue