From: Michel Dänzer <michel.daenzer@xxxxxxx> We were freeing it earlier but then still trying to access it in AMDGPUFreeRec. Signed-off-by: Michel Dänzer <michel.daenzer at amd.com> --- src/amdgpu_kms.c | 2 ++ src/amdgpu_probe.c | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c index 3598dd23f..44a99b564 100644 --- a/src/amdgpu_kms.c +++ b/src/amdgpu_kms.c @@ -138,6 +138,8 @@ static void AMDGPUFreeRec(ScrnInfoPtr pScrn) if (!pAMDGPUEnt->fd_ref) { amdgpu_device_deinitialize(pAMDGPUEnt->pDev); amdgpu_kernel_close_fd(pAMDGPUEnt); + free(pPriv->ptr); + pPriv->ptr = NULL; } } diff --git a/src/amdgpu_probe.c b/src/amdgpu_probe.c index fb62cb811..e446539d6 100644 --- a/src/amdgpu_probe.c +++ b/src/amdgpu_probe.c @@ -227,7 +227,7 @@ static Bool amdgpu_get_scrninfo(int entity_num, struct pci_device *pci_dev) pAMDGPUEnt = pPriv->ptr; if (!amdgpu_open_drm_master(pScrn, pAMDGPUEnt, busid)) - goto error_fd; + goto error; pAMDGPUEnt->fd_ref = 1; @@ -255,8 +255,6 @@ static Bool amdgpu_get_scrninfo(int entity_num, struct pci_device *pci_dev) error_amdgpu: amdgpu_kernel_close_fd(pAMDGPUEnt); -error_fd: - free(pPriv->ptr); error: free(busid); return FALSE; @@ -352,7 +350,7 @@ amdgpu_platform_probe(DriverPtr pDriver, pAMDGPUEnt->platform_dev = dev; pAMDGPUEnt->fd = amdgpu_kernel_open_fd(pScrn, busid, dev); if (pAMDGPUEnt->fd < 0) - goto error_fd; + goto error; pAMDGPUEnt->fd_ref = 1; @@ -380,8 +378,6 @@ amdgpu_platform_probe(DriverPtr pDriver, error_amdgpu: amdgpu_kernel_close_fd(pAMDGPUEnt); -error_fd: - free(pPriv->ptr); error: free(busid); return FALSE; -- 2.14.2