Module: Mesa
Branch: main
Commit: 257bb11332bcfee56d22407e9b58ac0a98e62a51
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=257bb11332bcfee56d22407e9b58ac0a98e62a51

Author: Joshua Peisach <[email protected]>
Date:   Tue Jan 17 21:09:05 2023 -0500

gallum/asahi: fix memory leak in agx_resource_from_handle

Missing FREE(rsc)


Apply 1 suggestion(s) to 1 file(s)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20760>

---

 src/gallium/drivers/asahi/agx_pipe.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/asahi/agx_pipe.c 
b/src/gallium/drivers/asahi/agx_pipe.c
index b0d05c08500..2d00c220a70 100644
--- a/src/gallium/drivers/asahi/agx_pipe.c
+++ b/src/gallium/drivers/asahi/agx_pipe.c
@@ -177,10 +177,12 @@ agx_resource_from_handle(struct pipe_screen *pscreen,
 
    agx_resource_setup(dev, rsc);
 
-   if (rsc->layout.tiling == AIL_TILING_LINEAR)
+   if (rsc->layout.tiling == AIL_TILING_LINEAR) {
       rsc->layout.linear_stride_B = whandle->stride;
-   else if (whandle->stride != ail_get_wsi_stride_B(&rsc->layout, 0))
+   } else if (whandle->stride != ail_get_wsi_stride_B(&rsc->layout, 0)) {
+      FREE(rsc);
       return NULL;
+   }
 
    assert(whandle->offset == 0);
 

Reply via email to