[llvm] 4f71051 - Fix memory leak I introduced in 2d66ed370a40

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 31 17:46:51 PST 2022


Author: Chris Bieneman
Date: 2022-01-31T19:44:47-06:00
New Revision: 4f710515fb0935c10997fedee3e8621250a26cbf

URL: https://github.com/llvm/llvm-project/commit/4f710515fb0935c10997fedee3e8621250a26cbf
DIFF: https://github.com/llvm/llvm-project/commit/4f710515fb0935c10997fedee3e8621250a26cbf.diff

LOG: Fix memory leak I introduced in 2d66ed370a40

This should fix the asan issue identified on the Linux asan bot.

Added: 
    

Modified: 
    llvm/unittests/Passes/PassBuilderBindingsTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Passes/PassBuilderBindingsTest.cpp b/llvm/unittests/Passes/PassBuilderBindingsTest.cpp
index 069c9803cae5e..ffa3fdaf6e7e6 100644
--- a/llvm/unittests/Passes/PassBuilderBindingsTest.cpp
+++ b/llvm/unittests/Passes/PassBuilderBindingsTest.cpp
@@ -19,6 +19,7 @@ class PassBuilderCTest : public testing::Test {
     char *Triple = LLVMGetDefaultTargetTriple();
     if (strlen(Triple) == 0) {
       GTEST_SKIP();
+      LLVMDisposeMessage(Triple);
       return;
     }
     LLVMInitializeAllTargetInfos();
@@ -38,8 +39,11 @@ class PassBuilderCTest : public testing::Test {
 
   void TearDown() override {
     char *Triple = LLVMGetDefaultTargetTriple();
-    if (strlen(Triple) == 0)
+    if (strlen(Triple) == 0) {
+      LLVMDisposeMessage(Triple);
       return; // Skipped, so nothing to tear down
+    }
+    LLVMDisposeMessage(Triple);
     LLVMDisposeTargetMachine(TM);
     LLVMDisposeModule(Module);
     LLVMContextDispose(Context);


        


More information about the llvm-commits mailing list