summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--logger.c2
-rw-r--r--memcached.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/logger.c b/logger.c
index 3cd7493..e02bb47 100644
--- a/logger.c
+++ b/logger.c
@@ -160,6 +160,7 @@ static void _logger_log_conn_event(logentry *e, const entry_details *d, const vo
static int _logger_util_addr_endpoint(struct sockaddr_in6 *addr, char *rip,
size_t riplen, unsigned short *rport) {
memset(rip, 0, riplen);
+ *rport = 0;
switch (addr->sin6_family) {
case AF_INET:
@@ -177,7 +178,6 @@ static int _logger_util_addr_endpoint(struct sockaddr_in6 *addr, char *rip,
case AF_UNSPEC:
case AF_UNIX:
strncpy(rip, "unix", strlen("unix") + 1);
- *rport = 0;
break;
#endif // #ifndef DISABLE_UNIX_SOCKET
}
diff --git a/memcached.c b/memcached.c
index 70cc8e3..0da9803 100644
--- a/memcached.c
+++ b/memcached.c
@@ -2124,6 +2124,7 @@ static void conn_to_str(const conn *c, char *addr, char *svr_addr) {
if (c->state == conn_listening ||
(IS_UDP(c->transport) &&
c->state == conn_read)) {
+ memset(&local_addr, 0, sizeof(local_addr));
socklen_t local_addr_len = sizeof(local_addr);
if (getsockname(c->sfd,
@@ -2137,6 +2138,7 @@ static void conn_to_str(const conn *c, char *addr, char *svr_addr) {
if (c->state != conn_listening && !(IS_UDP(c->transport) &&
c->state == conn_read)) {
struct sockaddr_storage svr_sock_addr;
+ memset(&svr_sock_addr, 0, sizeof(svr_sock_addr));
socklen_t svr_addr_len = sizeof(svr_sock_addr);
getsockname(c->sfd, (struct sockaddr *)&svr_sock_addr, &svr_addr_len);
get_conn_text(c, svr_sock_addr.ss_family, svr_addr, (struct sockaddr *)&svr_sock_addr);