mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
fix MCSectionELF to not leak memory, just like I did for MCSymbol.
MCSectionMachO is already fine (yay for fixed size arrays?), MCSectionCOFF still leaks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98537 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -53,11 +53,13 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
|
||||
ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)UniquingMap;
|
||||
|
||||
// Do the lookup, if we have a hit, return it.
|
||||
const MCSectionELF *&Entry = Map[Section];
|
||||
if (Entry) return Entry;
|
||||
StringMapEntry<const MCSectionELF*> &Entry = Map.GetOrCreateValue(Section);
|
||||
if (Entry.getValue()) return Entry.getValue();
|
||||
|
||||
return Entry = MCSectionELF::Create(Section, Type, Flags, Kind, IsExplicit,
|
||||
getContext());
|
||||
MCSectionELF *Result = MCSectionELF::Create(Entry.getKey(), Type, Flags, Kind,
|
||||
IsExplicit, getContext());
|
||||
Entry.setValue(Result);
|
||||
return Result;
|
||||
}
|
||||
|
||||
void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
|
||||
|
Reference in New Issue
Block a user