[clang] 1765edb - Fix memory leak introduced by llvmorg-11-init-11960-gbab6df86aef.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 15 19:39:48 PDT 2020


Author: Richard Smith
Date: 2020-04-15T19:39:39-07:00
New Revision: 1765edbb5660b028cee56f40e9a1988791762fd5

URL: https://github.com/llvm/llvm-project/commit/1765edbb5660b028cee56f40e9a1988791762fd5
DIFF: https://github.com/llvm/llvm-project/commit/1765edbb5660b028cee56f40e9a1988791762fd5.diff

LOG: Fix memory leak introduced by llvmorg-11-init-11960-gbab6df86aef.

Added: 
    

Modified: 
    clang/lib/AST/DeclCXX.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 8857a71f153f..6c611c2a4a30 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -3246,6 +3246,9 @@ APValue &MSGuidDecl::getAsAPValue() const {
       Arr.getArrayInitializedElt(I) =
           APValue(APSInt(APInt(8, PartVal.Part4And5[I]), true));
     }
+    // Register this APValue to be destroyed if necessary. (Note that the
+    // MSGuidDecl destructor is never run.)
+    getASTContext().addDestruction(&APVal);
   }
 
   return APVal;


        


More information about the cfe-commits mailing list