diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2017-06-22 08:26:27 -0400 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2017-06-22 08:26:27 -0400 |
commit | 288b15d0793936fa14b51ed860056f6ce6200c52 (patch) | |
tree | 5de9e9dca8b30e8d168da8661ae88e3ffe2504a3 /missing_d | |
parent | b7d8b6ebcd5dd714bc21acf7637d9a651e2f7ea7 (diff) | |
download | egawk-288b15d0793936fa14b51ed860056f6ce6200c52.tar.gz egawk-288b15d0793936fa14b51ed860056f6ce6200c52.tar.bz2 egawk-288b15d0793936fa14b51ed860056f6ce6200c52.zip |
Replace malloc+memset with calloc, mostly by using the new ezalloc macro.
Diffstat (limited to 'missing_d')
-rw-r--r-- | missing_d/ChangeLog | 4 | ||||
-rw-r--r-- | missing_d/getaddrinfo.c | 3 |
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) { |