Add a non-null guard in ~SourceInfo().
Prevent dereference from null Module object.
diff --git a/lib/ExecutionEngine/SourceInfo.cpp b/lib/ExecutionEngine/SourceInfo.cpp
index 9c49fcc..25c53e8 100644
--- a/lib/ExecutionEngine/SourceInfo.cpp
+++ b/lib/ExecutionEngine/SourceInfo.cpp
@@ -188,10 +188,12 @@
}
SourceInfo::~SourceInfo() {
- llvm::LLVMContext *context = &module->getContext();
- delete module;
- if (!shared_context)
- delete context;
+ if (module != NULL) {
+ llvm::LLVMContext *context = &module->getContext();
+ delete module;
+ if (!shared_context)
+ delete context;
+ }
}
#if USE_CACHE