Author: Jordan Rupprecht
Date: 2025-06-04T10:34:16-05:00
New Revision: 79f298e7e5ac88bc0041b1bd03e5210b8583cf03

URL: 
https://github.com/llvm/llvm-project/commit/79f298e7e5ac88bc0041b1bd03e5210b8583cf03
DIFF: 
https://github.com/llvm/llvm-project/commit/79f298e7e5ac88bc0041b1bd03e5210b8583cf03.diff

LOG: [lldb][test] Free buffers in demangling tests to avoid leaks (#142676)

Test case added by f669b9c3eca9438d33259aefb8156f977f1df382 / #137793.
Note that the `DemanglingParts` case above also frees the buffer; this
new test case is inconsistent.

Added: 
    

Modified: 
    lldb/unittests/Core/MangledTest.cpp

Removed: 
    


################################################################################
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

Reply via email to