about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-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()) {