Skip to content

Commit 79f298e

Browse files
authored
[lldb][test] Free buffers in demangling tests to avoid leaks (#142676)
Test case added by f669b9c / #137793. Note that the `DemanglingParts` case above also frees the buffer; this new test case is inconsistent.
1 parent afa517a commit 79f298e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lldb/unittests/Core/MangledTest.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,10 @@ TEST_P(DemanglingInfoCorrectnessTestFixutre, Correctness) {
642642
// function names.
643643
if (Root->getKind() !=
644644
llvm::itanium_demangle::Node::Kind::KFunctionEncoding &&
645-
Root->getKind() != llvm::itanium_demangle::Node::Kind::KDotSuffix)
645+
Root->getKind() != llvm::itanium_demangle::Node::Kind::KDotSuffix) {
646+
std::free(OB.getBuffer());
646647
return;
648+
}
647649

648650
ASSERT_TRUE(OB.NameInfo.hasBasename());
649651

@@ -670,6 +672,7 @@ TEST_P(DemanglingInfoCorrectnessTestFixutre, Correctness) {
670672
return_right, qualifiers, suffix);
671673

672674
EXPECT_EQ(reconstructed_name, demangled);
675+
std::free(OB.getBuffer());
673676
}
674677

675678
INSTANTIATE_TEST_SUITE_P(

0 commit comments

Comments
 (0)