Author: eugenis Date: Wed Sep 25 15:38:20 2019 New Revision: 372925 URL: http://llvm.org/viewvc/llvm-project?rev=372925&view=rev Log: Fix memory leak in DeclTest.
Fixes a leak introduced in r372903, detected on the ASan bot. http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/35430/steps/check-clang%20asan/logs/stdio Direct leak of 192 byte(s) in 1 object(s) allocated from: #0 0x561d88 in operator new(unsigned long) /b/sanitizer-x86_64-linux-fast/build/llvm-project/compiler-rt/lib/asan/asan_new_delete.cc:105 #1 0x1a48779 in clang::ItaniumMangleContext::create(clang::ASTContext&, clang::DiagnosticsEngine&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/AST/ItaniumMangle.cpp:5134:10 #2 0xdff000 in Decl_AsmLabelAttr_Test::TestBody() /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/unittests/AST/DeclTest.cpp:97:23 Modified: cfe/trunk/unittests/AST/DeclTest.cpp Modified: cfe/trunk/unittests/AST/DeclTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/DeclTest.cpp?rev=372925&r1=372924&r2=372925&view=diff ============================================================================== --- cfe/trunk/unittests/AST/DeclTest.cpp (original) +++ cfe/trunk/unittests/AST/DeclTest.cpp Wed Sep 25 15:38:20 2019 @@ -94,7 +94,8 @@ TEST(Decl, AsmLabelAttr) { // Mangle the decl names. std::string MangleF, MangleG; - MangleContext *MC = ItaniumMangleContext::create(Ctx, Diags); + std::unique_ptr<ItaniumMangleContext> MC( + ItaniumMangleContext::create(Ctx, Diags)); { llvm::raw_string_ostream OS_F(MangleF); llvm::raw_string_ostream OS_G(MangleG); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits