From: Marek Olšák Date: Mon, 19 Nov 2018 23:17:40 +0000 (-0500) Subject: winsys/amdgpu: fix a device handle leak in amdgpu_winsys_create X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d4e7d8b7f053db081a4ffdb59dc53f3531b0e60b;p=mesa.git winsys/amdgpu: fix a device handle leak in amdgpu_winsys_create Cc: 18.2 18.3 Reviewed-by: Bas Nieuwenhuizen --- 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; }