forked from OSchip/llvm-project
Get rid of some leaks found by VC leak detector.
Patch contributed by Morten Ofsted. llvm-svn: 18889
This commit is contained in:
parent
a125162bb0
commit
53bd3d0b1a
|
@ -51,6 +51,7 @@ namespace {
|
|||
unsigned char *CurStubPtr, *CurFunctionPtr;
|
||||
public:
|
||||
JITMemoryManager();
|
||||
~JITMemoryManager();
|
||||
|
||||
inline unsigned char *allocateStub(unsigned StubSize);
|
||||
inline unsigned char *startFunctionBody();
|
||||
|
@ -69,6 +70,10 @@ JITMemoryManager::JITMemoryManager() {
|
|||
CurStubPtr = CurFunctionPtr = FunctionBase;
|
||||
}
|
||||
|
||||
JITMemoryManager::~JITMemoryManager() {
|
||||
sys::Memory::ReleaseRWX(MemBlock);
|
||||
}
|
||||
|
||||
unsigned char *JITMemoryManager::allocateStub(unsigned StubSize) {
|
||||
CurStubPtr -= StubSize;
|
||||
if (CurStubPtr < MemBase) {
|
||||
|
|
|
@ -33,12 +33,10 @@ namespace llvm { extern std::ostream *GetLibSupportInfoOutputFile(); }
|
|||
// problem is that a Statistic<> object gets destroyed, which ends up calling
|
||||
// 'GetLibSupportInfoOutputFile()' (below), which calls this function.
|
||||
// LibSupportInfoOutputFilename used to be a global variable, but sometimes it
|
||||
// would get destroyed before the Statistic, causing havoc to ensue. We "fix"
|
||||
// this by creating the string the first time it is needed and never destroying
|
||||
// it.
|
||||
// would get destroyed before the Statistic, causing havoc to ensue.
|
||||
static std::string &getLibSupportInfoOutputFilename() {
|
||||
static std::string *LibSupportInfoOutputFilename = new std::string();
|
||||
return *LibSupportInfoOutputFilename;
|
||||
static std::string LibSupportInfoOutputFilename;
|
||||
return LibSupportInfoOutputFilename;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
Loading…
Reference in New Issue