From bbea1245a1b7e2bce79fe34d9331dab2e42fa3a4 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 12 May 2006 18:10:12 +0000 Subject: [PATCH] Fix a hypothetical memory leak, identified by Coverity. In practice, this object is never deleted though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28256 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ExecutionEngine/JIT/JITEmitter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp index 2a62bd3557c..00b23c17388 100644 --- a/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -392,12 +392,14 @@ JITMemoryManager::JITMemoryManager(bool useGOT) { // Allocate the GOT. GOTBase = NULL; - if (useGOT) GOTBase = (unsigned char*)malloc(sizeof(void*) * 8192); + if (useGOT) GOTBase = new unsigned char[sizeof(void*) * 8192]; } JITMemoryManager::~JITMemoryManager() { for (unsigned i = 0, e = Blocks.size(); i != e; ++i) sys::Memory::ReleaseRWX(Blocks[i]); + + delete[] GOTBase; Blocks.clear(); } -- 2.34.1