[Mesa-dev] [PATCH] aux/pipe_loader: Don't leak error string on dlopen failure
Aaron Watry
awatry at gmail.com
Fri Nov 14 09:48:06 PST 2014
Signed-off-by: Aaron Watry <awatry at gmail.com>
CC: Ilia Mirkin <imirkin at alum.mit.edu>
v4: Call dlerror() twice instead of freeing glibc's memory.
Prevents issues on C Libraries that don't malloc the error string.
v3: Switch comment to C-Style
v2: Use strdup instead of calloc/strcpy
---
src/gallium/auxiliary/pipe-loader/pipe_loader.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.c b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
index 8e79f85..f103497 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
@@ -25,6 +25,8 @@
*
**************************************************************************/
+#include <dlfcn.h>
+
#include "pipe_loader_priv.h"
#include "util/u_inlines.h"
@@ -101,6 +103,10 @@ pipe_loader_find_module(struct pipe_loader_device *dev,
if (lib) {
return lib;
}
+
+ /* Retrieve the dlerror() str twice. Once to populate the error, twice to clear it. */
+ dlerror();
+ dlerror();
}
}
--
2.1.0
More information about the mesa-dev
mailing list