https://github.com/dklimkin created https://github.com/llvm/llvm-project/pull/95927
AddressSanitizer: 56 byte(s) leaked in 1 allocation(s). (clang/unittests:lex_tests) >From f61a19058d3b7256702320fd4e94fb523615ccc9 Mon Sep 17 00:00:00 2001 From: Danial Klimkin <dklim...@google.com> Date: Tue, 18 Jun 2024 15:52:50 +0200 Subject: [PATCH] Fix memory leak in HeaderSearchTest --- clang/unittests/Lex/HeaderSearchTest.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/unittests/Lex/HeaderSearchTest.cpp b/clang/unittests/Lex/HeaderSearchTest.cpp index 38ce3812c204f..b0375d5985f2e 100644 --- a/clang/unittests/Lex/HeaderSearchTest.cpp +++ b/clang/unittests/Lex/HeaderSearchTest.cpp @@ -19,6 +19,8 @@ #include "clang/Serialization/InMemoryModuleCache.h" #include "llvm/Support/MemoryBuffer.h" #include "gtest/gtest.h" +#include <memory> +#include <string> namespace clang { namespace { @@ -350,8 +352,8 @@ TEST_F(HeaderSearchTest, HeaderFileInfoMerge) { std::string TextualPath = "/textual.h"; }; - auto ExternalSource = new MockExternalHeaderFileInfoSource(); - Search.SetExternalSource(ExternalSource); + auto ExternalSource = std::make_unique<MockExternalHeaderFileInfoSource>(); + Search.SetExternalSource(ExternalSource.get()); // Everything should start out external. auto ModularFE = AddHeader(ExternalSource->ModularPath); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits