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

sorber 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  5dc703a   Coverity CID #1241990 Resource leak
5dc703a is described below

commit 5dc703a942af59903c656a975f5872a853ba6df2
Author: Phil Sorber <sor...@apache.org>
AuthorDate: Thu May 11 20:47:54 2017 -0600

    Coverity CID #1241990 Resource leak
---
 plugins/experimental/ssl_cert_loader/ssl-cert-loader.cc | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/plugins/experimental/ssl_cert_loader/ssl-cert-loader.cc 
b/plugins/experimental/ssl_cert_loader/ssl-cert-loader.cc
index 8aa16b8..21b479d 100644
--- a/plugins/experimental/ssl_cert_loader/ssl-cert-loader.cc
+++ b/plugins/experimental/ssl_cert_loader/ssl-cert-loader.cc
@@ -259,6 +259,7 @@ int Parse_order = 0;
 void
 Parse_Config(Value &parent, ParsedSslValues &orig_values)
 {
+  bool inserted = false;
   ParsedSslValues cur_values(orig_values);
   Value val = parent.find("ssl-key-name");
 
@@ -299,6 +300,7 @@ Parse_Config(Value &parent, ParsedSslValues &orig_values)
     // Store in appropriate table
     if (cur_values.server_name.length() > 0) {
       Lookup.tree.insert(cur_values.server_name, entry, Parse_order++);
+      inserted = true;
     }
     if (cur_values.server_ips.size() > 0) {
       for (auto &server_ip : cur_values.server_ips) {
@@ -309,11 +311,17 @@ Parse_Config(Value &parent, ParsedSslValues &orig_values)
         char val1[256], val2[256];
         server_ip.first.toString(val1, sizeof(val1));
         server_ip.second.toString(val2, sizeof(val2));
+        inserted = true;
       }
     }
     if (entry != nullptr) {
-      for (const auto &cert_name : cert_names) {
-        Lookup.tree.insert(cert_name, entry, Parse_order++);
+      if (!cert_names.empty()) {
+        for (const auto &cert_name : cert_names) {
+          Lookup.tree.insert(cert_name, entry, Parse_order++);
+        }
+      } else if (!inserted) {
+        delete entry;
+        TSError(PCP "cert_names is empty and entry not otherwise inserted!");
       }
     }
   }

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Reply via email to