Skip to content

Commit 9348b48

Browse files
dklimkinAlexisPerry
authored andcommitted
[NFC]Fix memory leak in HeaderSearchTest (llvm#95927)
AddressSanitizer: 56 byte(s) leaked in 1 allocation(s). (clang/unittests:lex_tests)
1 parent 5430660 commit 9348b48

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clang/unittests/Lex/HeaderSearchTest.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "clang/Serialization/InMemoryModuleCache.h"
2020
#include "llvm/Support/MemoryBuffer.h"
2121
#include "gtest/gtest.h"
22+
#include <memory>
23+
#include <string>
2224

2325
namespace clang {
2426
namespace {
@@ -350,8 +352,8 @@ TEST_F(HeaderSearchTest, HeaderFileInfoMerge) {
350352
std::string TextualPath = "/textual.h";
351353
};
352354

353-
auto ExternalSource = new MockExternalHeaderFileInfoSource();
354-
Search.SetExternalSource(ExternalSource);
355+
auto ExternalSource = std::make_unique<MockExternalHeaderFileInfoSource>();
356+
Search.SetExternalSource(ExternalSource.get());
355357

356358
// Everything should start out external.
357359
auto ModularFE = AddHeader(ExternalSource->ModularPath);

0 commit comments

Comments
 (0)