summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/System/DynamicLibrary.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/System/DynamicLibrary.cpp b/lib/System/DynamicLibrary.cpp
index 9c52c8a18c..bdbcbd406f 100644
--- a/lib/System/DynamicLibrary.cpp
+++ b/lib/System/DynamicLibrary.cpp
@@ -63,7 +63,8 @@ bool DynamicLibrary::LoadLibraryPermanently(const char *Filename,
std::string *ErrMsg) {
void *H = dlopen(Filename, RTLD_LAZY);
if (H == 0) {
- ErrMsg = new std::string(dlerror());
+ if (ErrMsg)
+ *ErrMsg = dlerror();
return true;
}
OpenedHandles.push_back(H);