summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorTyker <tyker1@outlook.com>2019-11-19 21:05:30 +0100
committerTyker <tyker1@outlook.com>2019-11-19 21:11:37 +0100
commitc444a01df3553d9405cbd4dac3c1074a71e6c2e1 (patch)
treeb4889fbf80787f0ce7cb7941a601a9595ada79a7 /clang/lib
parentba71ca37208faf0916b4cae4298789796b791cfe (diff)
downloadbcm5719-llvm-c444a01df3553d9405cbd4dac3c1074a71e6c2e1.tar.gz
bcm5719-llvm-c444a01df3553d9405cbd4dac3c1074a71e6c2e1.zip
fixe leak found by asan build bot
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/DeclCXX.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index bca560c40ae..6908b6a2b0a 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -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;
}
OpenPOWER on IntegriCloud