You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2018/01/19 00:39:59 UTC
[trafficserver] branch master updated: Coverity ID 1241990: Fixes
memory leak
This is an automated email from the ASF dual-hosted git repository.
zwoop 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 f14df9e Coverity ID 1241990: Fixes memory leak
f14df9e is described below
commit f14df9e431099d415b243af94d692133c0b1b4d7
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Thu Jan 18 09:33:21 2018 +0900
Coverity ID 1241990: Fixes memory leak
---
.../ssl_cert_loader/ssl-cert-loader.cc | 43 +++++++++++++---------
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/plugins/experimental/ssl_cert_loader/ssl-cert-loader.cc b/plugins/experimental/ssl_cert_loader/ssl-cert-loader.cc
index 34fd419..685df7d 100644
--- a/plugins/experimental/ssl_cert_loader/ssl-cert-loader.cc
+++ b/plugins/experimental/ssl_cert_loader/ssl-cert-loader.cc
@@ -258,7 +258,6 @@ 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");
@@ -297,32 +296,40 @@ Parse_Config(Value &parent, ParsedSslValues &orig_values)
std::deque<std::string> cert_names;
SslEntry *entry = Load_Certificate_Entry(cur_values, cert_names);
- // 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) {
- IpEndpoint first, second;
- first.assign(server_ip.first);
- second.assign(server_ip.second);
- Lookup.ipmap.fill(&first, &second, entry);
- char val1[256], val2[256];
- server_ip.first.toString(val1, sizeof(val1));
- server_ip.second.toString(val2, sizeof(val2));
+ if (entry) {
+ bool inserted = false;
+
+ // Store in appropriate table
+ if (cur_values.server_name.length() > 0) {
+ Lookup.tree.insert(cur_values.server_name, entry, Parse_order++);
inserted = true;
}
- }
- if (entry != nullptr) {
+ if (cur_values.server_ips.size() > 0) {
+ for (auto &server_ip : cur_values.server_ips) {
+ IpEndpoint first, second;
+ first.assign(server_ip.first);
+ second.assign(server_ip.second);
+ Lookup.ipmap.fill(&first, &second, entry);
+ char val1[256], val2[256];
+ server_ip.first.toString(val1, sizeof(val1));
+ server_ip.second.toString(val2, sizeof(val2));
+ inserted = true;
+ }
+ }
+
if (cert_names.size() > 0) {
for (const auto &cert_name : cert_names) {
Lookup.tree.insert(cert_name, entry, Parse_order++);
+ inserted = true;
}
- } else if (!inserted) {
+ }
+
+ if (!inserted) {
delete entry;
TSError(PCP "cert_names is empty and entry not otherwise inserted!");
}
+ } else {
+ TSError(PCP "failed to load the certificate entry");
}
}
}
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].