pipe-loader: teardown the winsys, if create_screen fails
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 17 Oct 2015 19:53:16 +0000 (20:53 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Sat, 21 Nov 2015 12:52:19 +0000 (12:52 +0000)
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@gmail.com>
Acked-by: Rob Clark <robclark@freedesktop.org>
src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c

index 816ff1c85d3042b04491f61814ac059bc0bd90b8..85e06d312edf2b4118c9bbba9928f2ae3ea0ab8a 100644 (file)
@@ -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 = {