[Mesa-dev] [PATCH v2 16/40] pipe-loader: teardown the winsys, if create_screen fails

Emil Velikov emil.l.velikov at gmail.com
Fri Nov 20 12:11:25 PST 2015


i.e. plug some (hard to hit) memory leaks.

v2: fix rebase fallout - really teardown the winsys (Brian)
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
Acked-by: Rob Clark <robclark at freedesktop.org>
---
 src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
index 816ff1c..85e06d3 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
@@ -240,8 +240,13 @@ static struct pipe_screen *
 pipe_loader_sw_create_screen(struct pipe_loader_device *dev)
 {
    struct pipe_loader_sw_device *sdev = pipe_loader_sw_device(dev);
+   struct pipe_screen *screen;
 
-   return sdev->dd->create_screen(sdev->ws);
+   screen = sdev->dd->create_screen(sdev->ws);
+   if (!screen)
+      sdev->ws->destroy(sdev->ws);
+
+   return screen;
 }
 
 static struct pipe_loader_ops pipe_loader_sw_ops = {
-- 
2.6.2



More information about the mesa-dev mailing list