mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
[Support/StringSet] Fix memory leak when inserted key already exists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166517 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e1d4a88134
commit
ce892ca9bc
@ -29,8 +29,13 @@ namespace llvm {
|
||||
assert(!InLang.empty());
|
||||
const char *KeyStart = InLang.data();
|
||||
const char *KeyEnd = KeyStart + InLang.size();
|
||||
return base::insert(llvm::StringMapEntry<char>::
|
||||
Create(KeyStart, KeyEnd, base::getAllocator(), '+'));
|
||||
llvm::StringMapEntry<char> *Entry = llvm::StringMapEntry<char>::
|
||||
Create(KeyStart, KeyEnd, base::getAllocator(), '+');
|
||||
if (!base::insert(Entry)) {
|
||||
Entry->Destroy(base::getAllocator());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user