drisw: don't leak the winsys

if a winsys is allocated by the frontend, it should be freed by the frontend
rather than the driver to ensure it doesn't leak if it doesn't reach
the driver

cc: mesa-stable

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22396>
(cherry picked from commit 1e6e3427f0)
This commit is contained in:
Mike Blumenkrantz 2023-04-10 09:47:06 -04:00 committed by Dylan Baker
parent 53f0dd5362
commit 34b6a45e53
4 changed files with 2 additions and 10 deletions

View file

@ -2594,7 +2594,7 @@
"description": "drisw: don't leak the winsys",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -382,6 +382,7 @@ pipe_loader_sw_release(struct pipe_loader_device **dev)
UNUSED struct pipe_loader_sw_device *sdev =
pipe_loader_sw_device(*dev);
sdev->ws->destroy(sdev->ws);
#ifndef GALLIUM_STATIC_TARGETS
if (sdev->lib)
util_dl_close(sdev->lib);

View file

@ -854,7 +854,6 @@ static void
llvmpipe_destroy_screen(struct pipe_screen *_screen)
{
struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
struct sw_winsys *winsys = screen->winsys;
if (screen->cs_tpool)
lp_cs_tpool_destroy(screen->cs_tpool);
@ -865,8 +864,6 @@ llvmpipe_destroy_screen(struct pipe_screen *_screen)
lp_jit_screen_cleanup(screen);
disk_cache_destroy(screen->disk_shader_cache);
if (winsys->destroy)
winsys->destroy(winsys);
glsl_type_singleton_decref();

View file

@ -487,12 +487,6 @@ softpipe_is_format_supported( struct pipe_screen *screen,
static void
softpipe_destroy_screen( struct pipe_screen *screen )
{
struct softpipe_screen *sp_screen = softpipe_screen(screen);
struct sw_winsys *winsys = sp_screen->winsys;
if(winsys->destroy)
winsys->destroy(winsys);
FREE(screen);
}