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 2016/03/26 23:50:13 UTC
trafficserver git commit: TS-4305 Fixes coverity issues in geoip_acl
plugin
Repository: trafficserver
Updated Branches:
refs/heads/master b1b8267ab -> ed627e509
TS-4305 Fixes coverity issues in geoip_acl plugin
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/ed627e50
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/ed627e50
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/ed627e50
Branch: refs/heads/master
Commit: ed627e509041d4068ba42a30156ee311c9f86e4f
Parents: b1b8267
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sat Mar 26 09:32:01 2016 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Sat Mar 26 16:49:23 2016 -0600
----------------------------------------------------------------------
plugins/experimental/geoip_acl/acl.cc | 10 +++++-----
plugins/experimental/geoip_acl/acl.h | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed627e50/plugins/experimental/geoip_acl/acl.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/geoip_acl/acl.cc b/plugins/experimental/geoip_acl/acl.cc
index b1c25e6..d16f399 100644
--- a/plugins/experimental/geoip_acl/acl.cc
+++ b/plugins/experimental/geoip_acl/acl.cc
@@ -133,7 +133,7 @@ RegexAcl::parse_line(const char *filename, const std::string &line, int lineno)
return false;
}
pos1 = line.find_first_not_of(_SEPARATOR);
- if (line[pos1] == '#' || pos1 == std::string::npos) {
+ if ((pos1 == std::string::npos) || (line[pos1] == '#')) {
return false;
}
@@ -237,18 +237,18 @@ CountryAcl::read_regex(const char *fn)
while (!f.eof()) {
getline(f, line);
++lineno;
- if (!acl) {
- acl = new RegexAcl(new CountryAcl());
- }
+ acl = new RegexAcl(new CountryAcl());
if (acl->parse_line(fn, line, lineno)) {
if (NULL == _regexes) {
_regexes = acl;
} else {
_regexes->append(acl);
}
- acl = NULL;
+ } else {
+ TSfree(acl);
}
}
+
f.close();
TSDebug(PLUGIN_NAME, "Loaded regex rules from %s", fn);
} else {
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed627e50/plugins/experimental/geoip_acl/acl.h
----------------------------------------------------------------------
diff --git a/plugins/experimental/geoip_acl/acl.h b/plugins/experimental/geoip_acl/acl.h
index 8225869..8af80e9 100644
--- a/plugins/experimental/geoip_acl/acl.h
+++ b/plugins/experimental/geoip_acl/acl.h
@@ -47,7 +47,7 @@ static const int NUM_ISO_CODES = 253;
class Acl
{
public:
- Acl() : _allow(true) {}
+ Acl() : _allow(true), _added_tokens(0) {}
virtual ~Acl() {}
@@ -93,7 +93,7 @@ protected:
class RegexAcl
{
public:
- RegexAcl(Acl *acl) : _next(NULL), _acl(acl) {}
+ RegexAcl(Acl *acl) : _extra(NULL), _next(NULL), _acl(acl) {}
const std::string &
get_regex() const