This is an automated email from the ASF dual-hosted git repository.

dmeden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 007f8a16a1 Coverity - fix some new unit test's new issues. (#12043)
007f8a16a1 is described below

commit 007f8a16a1adc9a07197a15217bdd29f58ffa978
Author: Damian Meden <[email protected]>
AuthorDate: Wed Feb 19 10:05:29 2025 +0100

    Coverity - fix some new unit test's new issues. (#12043)
    
    * CID-1591517 Resource leak fix
    * CID-1591558 Explicit null dereferenced fix
---
 src/proxy/http/remap/unit-tests/test_PluginFactory.cc | 7 ++++++-
 src/proxy/http/remap/unit-tests/test_RemapRules.cc    | 5 ++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/proxy/http/remap/unit-tests/test_PluginFactory.cc 
b/src/proxy/http/remap/unit-tests/test_PluginFactory.cc
index ff78963e5e..df7b1c971d 100644
--- a/src/proxy/http/remap/unit-tests/test_PluginFactory.cc
+++ b/src/proxy/http/remap/unit-tests/test_PluginFactory.cc
@@ -123,7 +123,12 @@ class GlobalPluginInfo
 {
 public:
   GlobalPluginInfo() : _dlh(nullptr){};
-  ~GlobalPluginInfo(){};
+  ~GlobalPluginInfo()
+  {
+    if (_dlh) {
+      dlclose(_dlh);
+    }
+  };
 
   bool
   loadDso(const fs::path &configPath)
diff --git a/src/proxy/http/remap/unit-tests/test_RemapRules.cc 
b/src/proxy/http/remap/unit-tests/test_RemapRules.cc
index b09c7a1c89..1e133ff0e3 100644
--- a/src/proxy/http/remap/unit-tests/test_RemapRules.cc
+++ b/src/proxy/http/remap/unit-tests/test_RemapRules.cc
@@ -112,9 +112,8 @@ SCENARIO("Parsing ACL named filters", "[proxy][remap]")
       THEN("The rule uses the last action specified")
       {
         REQUIRE(remap_parse_config_bti(cpath.c_str(), &bti) == true);
-        REQUIRE(bti.rules_list != nullptr);
-        REQUIRE(bti.rules_list->next == nullptr);
-        REQUIRE(bti.rules_list->allow_flag == true);
+        REQUIRE((bti.rules_list != nullptr && bti.rules_list->next == 
nullptr));
+        REQUIRE((bti.rules_list != nullptr && bti.rules_list->allow_flag == 
true));
       }
     }
   }

Reply via email to