mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 07:34:33 +00:00
Fix a memory leak in the error path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211184 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
debd831223
commit
a841620f66
@ -17,8 +17,8 @@
|
||||
namespace llvm {
|
||||
using namespace object;
|
||||
|
||||
ErrorOr<ObjectFile *> ObjectFile::createELFObjectFile(MemoryBuffer *Obj,
|
||||
bool BufferOwned) {
|
||||
static ErrorOr<ObjectFile *> createELFObjectFileAux(MemoryBuffer *Obj,
|
||||
bool BufferOwned) {
|
||||
std::pair<unsigned char, unsigned char> Ident = getElfArchType(Obj);
|
||||
std::size_t MaxAlignment =
|
||||
1ULL << countTrailingZeros(uintptr_t(Obj->getBufferStart()));
|
||||
@ -82,4 +82,12 @@ ErrorOr<ObjectFile *> ObjectFile::createELFObjectFile(MemoryBuffer *Obj,
|
||||
return R.release();
|
||||
}
|
||||
|
||||
ErrorOr<ObjectFile *> ObjectFile::createELFObjectFile(MemoryBuffer *Obj,
|
||||
bool BufferOwned) {
|
||||
ErrorOr<ObjectFile *> Ret = createELFObjectFileAux(Obj, BufferOwned);
|
||||
if (BufferOwned && Ret.getError())
|
||||
delete Obj;
|
||||
return Ret;
|
||||
}
|
||||
|
||||
} // end namespace llvm
|
||||
|
Loading…
x
Reference in New Issue
Block a user