[Lldb-commits] [lldb] [lldb][test] Free buffers in demangling tests to avoid leaks (PR #142676)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 3 14:59:27 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Jordan Rupprecht (rupprecht)
<details>
<summary>Changes</summary>
Test case added by f669b9c3eca9438d33259aefb8156f977f1df382 / #<!-- -->137793. Note that the `DemanglingParts` case above also frees the buffer; this new test case is inconsistent.
---
Full diff: https://github.com/llvm/llvm-project/pull/142676.diff
1 Files Affected:
- (modified) lldb/unittests/Core/MangledTest.cpp (+4-1)
``````````diff
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(
``````````
</details>
https://github.com/llvm/llvm-project/pull/142676
More information about the lldb-commits
mailing list