Fix a hypothetical memory leak, identified by Coverity. In practice, this
authorChris Lattner <sabre@nondot.org>
Fri, 12 May 2006 18:10:12 +0000 (18:10 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 12 May 2006 18:10:12 +0000 (18:10 +0000)
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

index 2a62bd3557c5f95c848fa42592090826cf8138f3..00b23c173888451ae64f179db33e2a9851537521 100644 (file)
@@ -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();
 }