Module: Mesa
Branch: staging/23.0
Commit: 34b6a45e53c0ef23ee662cceeaef0cafcf577f27
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=34b6a45e53c0ef23ee662cceeaef0cafcf577f27

Author: Mike Blumenkrantz <[email protected]>
Date:   Mon Apr 10 09:47:06 2023 -0400

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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22396>
(cherry picked from commit 1e6e3427f032a3ca0193d57facbd9a63b75e6a7c)

---

 .pick_status.json                                  | 2 +-
 src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c | 1 +
 src/gallium/drivers/llvmpipe/lp_screen.c           | 3 ---
 src/gallium/drivers/softpipe/sp_screen.c           | 6 ------
 4 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 0d7889cff71..3edb4ce951a 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -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
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c 
b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
index 75a247d43d1..e11837f2c47 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
@@ -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);
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
b/src/gallium/drivers/llvmpipe/lp_screen.c
index 644c3845327..c1e8ce5f28f 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -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();
 
diff --git a/src/gallium/drivers/softpipe/sp_screen.c 
b/src/gallium/drivers/softpipe/sp_screen.c
index 50f14a0bd55..dc1480be58a 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -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);
 }
 

Reply via email to