From 2497fdcb63ab5af7c047b384f4373cd0f2b95f2d Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Thu, 21 Aug 2014 00:26:44 +0100 Subject: Fix segfault under LLVM3.5 . I forgot to release ownership of the MemoryBuffer from the std::unique_ptr when getLazyBitcodeModule() succesfully takes ownership. --- tools/klee/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tools') 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()) { -- cgit 1.4.1