[Mesa-stable] [PATCH 2/8] pipe_loader/sw: close dev->lib when initialization fails

Aaron Watry awatry at gmail.com
Tue Dec 17 14:34:35 PST 2013


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);
 }
-- 
1.8.3.2



More information about the mesa-stable mailing list