[PATCH xf86-video-amdgpu 11/19] Don't leak a AMDGPUEntRec instance if amdgpu_device_setup fails

Michel Dänzer michel at daenzer.net
Tue Apr 10 08:28:12 UTC 2018


On 2018-04-04 04:29 PM, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> Seems like we've been leaking this for years. It became more obvious
> with the recent refactoring.
> 
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
>  src/amdgpu_probe.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/amdgpu_probe.c b/src/amdgpu_probe.c
> index 537d44c..588891c 100644
> --- a/src/amdgpu_probe.c
> +++ b/src/amdgpu_probe.c
> @@ -243,6 +243,8 @@ amdgpu_probe(ScrnInfoPtr pScrn, int entity_num,
>  	return TRUE;
>  
>  error:
> +	free(pPriv->ptr);
> +	pPriv->ptr = NULL;
>  	return FALSE;
>  }
>  
> 

valgrind doesn't report a leak if I force this error path; presumably
Xorg frees the private after returning FALSE here.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the amd-gfx mailing list