about summary refs log tree commit diff homepage
path: root/tools
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2014-08-21 00:26:44 +0100
committerDaniel Dunbar <daniel@zuster.org>2014-09-17 08:09:54 -0700
commit2497fdcb63ab5af7c047b384f4373cd0f2b95f2d (patch)
tree25f8329afa12b7558add09bcf1b208ac3c3e0acb /tools
parent05a3dcd0f55f948767c089c137e93c8fe22a3045 (diff)
downloadklee-2497fdcb63ab5af7c047b384f4373cd0f2b95f2d.tar.gz
Fix segfault under LLVM3.5 . I forgot to release ownership of the
MemoryBuffer from the std::unique_ptr when getLazyBitcodeModule()
succesfully takes ownership.
Diffstat (limited to 'tools')
-rw-r--r--tools/klee/main.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 636b933b..fce4e317 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -1241,9 +1241,15 @@ int main(int argc, char **argv, char **envp) {
 
   auto mainModuleOrError = getLazyBitcodeModule(Buffer->get(), getGlobalContext());
 
-  if (!mainModuleOrError)
+  if (!mainModuleOrError) {
     klee_error("error loading program '%s': %s", InputFile.c_str(),
                mainModuleOrError.getError().message().c_str());
+  }
+  else {
+    // The module has taken ownership of the MemoryBuffer so release it
+    // from the std::unique_ptr
+    Buffer->release();
+  }
 
   mainModule = *mainModuleOrError;
   if (auto ec = mainModule->materializeAllPermanently()) {