Mesa (master): pipe_loader/sw: close dev->lib when initialization fails

Aaron Watry awatry at kemper.freedesktop.org
Mon Dec 23 13:26:50 UTC 2013


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

Author: Aaron Watry <awatry at gmail.com>
Date:   Fri Nov  8 13:45:05 2013 -0600

pipe_loader/sw: close dev->lib when initialization fails

Prevents a memory leak.

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>

CC: "10.0" <mesa-stable at lists.freedesktop.org>

---

 src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c |    5 ++++-
 1 file changed, 4 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 c2b78c6..382e116 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
@@ -95,8 +95,11 @@ pipe_loader_sw_create_screen(struct pipe_loader_device *dev,
       return NULL;
 
    init = (void *)util_dl_get_proc_address(sdev->lib, "swrast_create_screen");
-   if (!init)
+   if (!init){
+      util_dl_close(sdev->lib);
+      sdev->lib = NULL;
       return NULL;
+   }
 
    return init(sdev->ws);
 }




More information about the mesa-commit mailing list