aboutsummaryrefslogtreecommitdiffstats
path: root/missing_d
diff options
context:
space:
mode:
Diffstat (limited to 'missing_d')
-rw-r--r--missing_d/ChangeLog4
-rw-r--r--missing_d/getaddrinfo.c3
2 files changed, 5 insertions, 2 deletions
diff --git a/missing_d/ChangeLog b/missing_d/ChangeLog
index 83f5b93e..7d9bddc4 100644
--- a/missing_d/ChangeLog
+++ b/missing_d/ChangeLog
@@ -1,3 +1,7 @@
+2017-06-21 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * getaddrinfo.c (getaddrinfo): Replace malloc+memset with calloc.
+
2016-10-23 Arnold D. Robbins <arnold@skeeve.com>
* General: Remove trailing whitespace from all relevant files.
diff --git a/missing_d/getaddrinfo.c b/missing_d/getaddrinfo.c
index f24ac598..5233cf56 100644
--- a/missing_d/getaddrinfo.c
+++ b/missing_d/getaddrinfo.c
@@ -33,12 +33,11 @@ getaddrinfo(const char *hostname, const char *portname,
if (res == NULL)
return EINVAL;
- out = (struct addrinfo *) malloc(sizeof(*out));
+ out = (struct addrinfo *) calloc(1, sizeof(*out));
if (out == NULL) {
*res = NULL;
return ENOMEM;
}
- memset(out, '\0', sizeof(*out));
out->ai_addr = (struct sockaddr *) malloc(sizeof(struct sockaddr_in));
if (out->ai_addr == NULL) {