From d4e7d8b7f053db081a4ffdb59dc53f3531b0e60b Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 19 Nov 2018 18:17:40 -0500 Subject: winsys/amdgpu: fix a device handle leak in amdgpu_winsys_create Cc: 18.2 18.3 Reviewed-by: Bas Nieuwenhuizen --- src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c index f32bbd9d086..b20d702670d 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c @@ -280,6 +280,12 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config, if (ws) { pipe_reference(NULL, &ws->reference); simple_mtx_unlock(&dev_tab_mutex); + + /* Release the device handle, because we don't need it anymore. + * This function is returning an existing winsys instance, which + * has its own device handle. + */ + amdgpu_device_deinitialize(dev); return &ws->base; } -- cgit v1.2.3