forked from OSchip/llvm-project
fixe leak found by asan build bot
This commit is contained in:
parent
ba71ca3720
commit
c444a01df3
|
@ -2818,8 +2818,10 @@ StorageDuration LifetimeExtendedTemporaryDecl::getStorageDuration() const {
|
|||
APValue *LifetimeExtendedTemporaryDecl::getOrCreateValue(bool MayCreate) const {
|
||||
assert(getStorageDuration() == SD_Static &&
|
||||
"don't need to cache the computed value for this temporary");
|
||||
if (MayCreate && !Value)
|
||||
if (MayCreate && !Value) {
|
||||
Value = (new (getASTContext()) APValue);
|
||||
getASTContext().addDestruction(Value);
|
||||
}
|
||||
assert(Value && "may not be null");
|
||||
return Value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue