aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ExecutionEngine
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
commit3f91bb3ce4c8f6e31c4051cc10799e54c3a26a3a (patch)
treefcf4f4069c6790edffeb4168566415623a177500 /lib/ExecutionEngine
parentc91e40a1795629b02f682bc8216b42c5ec60fccf (diff)
downloadexternal_llvm-3f91bb3ce4c8f6e31c4051cc10799e54c3a26a3a.zip
external_llvm-3f91bb3ce4c8f6e31c4051cc10799e54c3a26a3a.tar.gz
external_llvm-3f91bb3ce4c8f6e31c4051cc10799e54c3a26a3a.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index 5720149..986ec91 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/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);