Mesa (master): zink: fix free of ralloced pointer

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Mar 17 13:17:05 UTC 2021


Module: Mesa
Branch: master
Commit: d4bcb58caf62f52734bb3ba10a87d0f9d71d73fa
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d4bcb58caf62f52734bb3ba10a87d0f9d71d73fa

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Wed Mar 17 10:32:15 2021 +0100

zink: fix free of ralloced pointer

When we alloc with ralloc, we also need to free with it.

But let's take a step back here; we don't just need to use ralloc, we
also need to destroy all other screen-resources. So let's call the
destructor here instead.

Fixes: 2643f9ed284 ("zink: ralloc screen objects")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9647>

---

 src/gallium/drivers/zink/zink_screen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index 62990de35f8..5a945f52d61 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -1461,7 +1461,7 @@ zink_drm_create_screen(int fd, const struct pipe_screen_config *config)
 
    if (ret && !ret->info.have_KHR_external_memory_fd) {
       debug_printf("ZINK: KHR_external_memory_fd required!\n");
-      free(ret);
+      zink_destroy_screen(&ret->base);
       return NULL;
    }
 



More information about the mesa-commit mailing list