summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-16 21:47:59 +0000
committerChris Lattner <sabre@nondot.org>2009-04-16 21:47:59 +0000
commit11ceb38df04233d1601a1f5c4d49624c8003c457 (patch)
tree08eecaab58e125070ef0fdd751e91a50fd86f3f5
parentde578e8cc67f7da8ab004939e5a304c866453bac (diff)
downloadbcm5719-llvm-11ceb38df04233d1601a1f5c4d49624c8003c457.tar.gz
bcm5719-llvm-11ceb38df04233d1601a1f5c4d49624c8003c457.zip
make sure to unlock keymgr if the JIT is created and destroyed, all
locks must be matched with unlocks. Also, use calloc to allocate the block so that it is properly zero'd. Thanks to Nick Kledzik for tracking this down. llvm-svn: 69314
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JIT.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
index 57201493e07..986ec91ede0 100644
--- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
@@ -237,11 +237,9 @@ JIT::JIT(ModuleProvider *MP, TargetMachine &tm, TargetJITInfo &tji,
// The key is created on demand, and libgcc creates it the first time an
// exception occurs. Since we need the key to register frames, we create
// it now.
- if (!LOI) {
- LOI = (LibgccObjectInfo*)malloc(sizeof(struct LibgccObjectInfo));
- _keymgr_set_and_unlock_processwide_ptr(KEYMGR_GCC3_DW2_OBJ_LIST,
- LOI);
- }
+ if (!LOI)
+ LOI = (LibgccObjectInfo*)calloc(sizeof(struct LibgccObjectInfo), 1);
+ _keymgr_set_and_unlock_processwide_ptr(KEYMGR_GCC3_DW2_OBJ_LIST, LOI);
InstallExceptionTableRegister(DarwinRegisterFrame);
#else
InstallExceptionTableRegister(__register_frame);
OpenPOWER on IntegriCloud