You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2017/05/14 01:45:31 UTC
[trafficserver] branch master updated: Coverity CID #1021755
Uninitialized pointer field
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 adc1f56 Coverity CID #1021755 Uninitialized pointer field
adc1f56 is described below
commit adc1f56997194cfc5cfeb61307c020b96c55bbdb
Author: Phil Sorber <so...@apache.org>
AuthorDate: Sat May 13 13:11:17 2017 -0600
Coverity CID #1021755 Uninitialized pointer field
This is a follow-up based on feedback from James Peach.
---
iocore/dns/I_DNSProcessor.h | 9 +--------
iocore/dns/SRV.h | 23 +++++++++--------------
2 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/iocore/dns/I_DNSProcessor.h b/iocore/dns/I_DNSProcessor.h
index 965fd1c..0c3d324 100644
--- a/iocore/dns/I_DNSProcessor.h
+++ b/iocore/dns/I_DNSProcessor.h
@@ -40,23 +40,16 @@
*/
struct HostEnt : RefCountObj {
- struct hostent ent;
+ struct hostent ent = {.h_name = nullptr, .h_aliases = nullptr, .h_addrtype = 0, .h_length = 0, .h_addr_list = nullptr};
uint32_t ttl = 0;
int packet_size = 0;
char buf[MAX_DNS_PACKET_LEN] = {0};
u_char *host_aliases[DNS_MAX_ALIASES] = {nullptr};
u_char *h_addr_ptrs[DNS_MAX_ADDRS + 1] = {nullptr};
u_char hostbuf[DNS_HOSTBUF_SIZE] = {0};
-
SRVHosts srv_hosts;
virtual void free();
-
- HostEnt()
- {
- ink_zero(ent);
- ink_zero(srv_hosts);
- }
};
extern EventType ET_DNS;
diff --git a/iocore/dns/SRV.h b/iocore/dns/SRV.h
index 0bd441d..9b09c52 100644
--- a/iocore/dns/SRV.h
+++ b/iocore/dns/SRV.h
@@ -33,15 +33,13 @@ struct HostDBInfo;
#define RAND_INV_RANGE(r) ((int)((RAND_MAX + 1) / (r)))
struct SRV {
- unsigned int weight;
- unsigned int port;
- unsigned int priority;
- unsigned int ttl;
- unsigned int host_len;
- unsigned int key;
- char host[MAXDNAME];
-
- SRV() : weight(0), port(0), priority(0), ttl(0), host_len(0), key(0) { host[0] = '\0'; }
+ unsigned int weight = 0;
+ unsigned int port = 0;
+ unsigned int priority = 0;
+ unsigned int ttl = 0;
+ unsigned int host_len = 0;
+ unsigned int key = 0;
+ char host[MAXDNAME] = {0};
};
inline bool
@@ -52,12 +50,9 @@ operator<(const SRV &left, const SRV &right)
}
struct SRVHosts {
- unsigned srv_host_count;
- unsigned srv_hosts_length;
+ unsigned int srv_host_count = 0;
+ unsigned int srv_hosts_length = 0;
SRV hosts[HOST_DB_MAX_ROUND_ROBIN_INFO];
-
- ~SRVHosts() {}
- SRVHosts() : srv_host_count(0), srv_hosts_length(0) {}
};
#endif
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].