https://github.com/rupprecht created https://github.com/llvm/llvm-project/pull/142676
Test case added by f669b9c3eca9438d33259aefb8156f977f1df382 / #137793. Note that the `DemanglingParts` case above also frees the buffer; this new test case is inconsistent. >From 270b38ccfe58011c2b22e89e5b5757df3a17c35c Mon Sep 17 00:00:00 2001 From: Jordan Rupprecht <ruppre...@google.com> Date: Tue, 3 Jun 2025 14:56:35 -0700 Subject: [PATCH] [lldb][test] Free buffers in demangling tests to avoid leaks --- lldb/unittests/Core/MangledTest.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lldb/unittests/Core/MangledTest.cpp b/lldb/unittests/Core/MangledTest.cpp index dfdc026521379..e9dfd05459642 100644 --- a/lldb/unittests/Core/MangledTest.cpp +++ b/lldb/unittests/Core/MangledTest.cpp @@ -642,8 +642,10 @@ TEST_P(DemanglingInfoCorrectnessTestFixutre, Correctness) { // function names. if (Root->getKind() != llvm::itanium_demangle::Node::Kind::KFunctionEncoding && - Root->getKind() != llvm::itanium_demangle::Node::Kind::KDotSuffix) + Root->getKind() != llvm::itanium_demangle::Node::Kind::KDotSuffix) { + std::free(OB.getBuffer()); return; + } ASSERT_TRUE(OB.NameInfo.hasBasename()); @@ -670,6 +672,7 @@ TEST_P(DemanglingInfoCorrectnessTestFixutre, Correctness) { return_right, qualifiers, suffix); EXPECT_EQ(reconstructed_name, demangled); + std::free(OB.getBuffer()); } INSTANTIATE_TEST_SUITE_P( _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits