From: Chris Lattner Date: Fri, 12 May 2006 18:10:12 +0000 (+0000) Subject: Fix a hypothetical memory leak, identified by Coverity. In practice, this X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=bbea1245a1b7e2bce79fe34d9331dab2e42fa3a4;p=oota-llvm.git 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 --- 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(); }