Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 01f5ebc

Browse files
committed
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372925 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 258784d commit 01f5ebc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

unittests/AST/DeclTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ TEST(Decl, AsmLabelAttr) {
9494

9595
// Mangle the decl names.
9696
std::string MangleF, MangleG;
97-
MangleContext *MC = ItaniumMangleContext::create(Ctx, Diags);
97+
std::unique_ptr<ItaniumMangleContext> MC(
98+
ItaniumMangleContext::create(Ctx, Diags));
9899
{
99100
llvm::raw_string_ostream OS_F(MangleF);
100101
llvm::raw_string_ostream OS_G(MangleG);

0 commit comments

Comments
 (0)