fixe leak found by asan build bot

This commit is contained in:
Tyker 2019-11-19 21:05:30 +01:00
parent ba71ca3720
commit c444a01df3
1 changed files with 3 additions and 1 deletions

View File

@ -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;
}