Module Name: src Committed By: nia Date: Wed Oct 27 19:24:38 UTC 2021
Modified Files: src/lib/libc/net: getaddrinfo.c Log Message: getaddrinfo(3): malloc + memset -> calloc To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/lib/libc/net/getaddrinfo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/net/getaddrinfo.c diff -u src/lib/libc/net/getaddrinfo.c:1.120 src/lib/libc/net/getaddrinfo.c:1.121 --- src/lib/libc/net/getaddrinfo.c:1.120 Wed Nov 18 12:49:52 2020 +++ src/lib/libc/net/getaddrinfo.c Wed Oct 27 19:24:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: getaddrinfo.c,v 1.120 2020/11/18 12:49:52 is Exp $ */ +/* $NetBSD: getaddrinfo.c,v 1.121 2021/10/27 19:24:38 nia Exp $ */ /* $KAME: getaddrinfo.c,v 1.29 2000/08/31 17:26:57 itojun Exp $ */ /* @@ -55,7 +55,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: getaddrinfo.c,v 1.120 2020/11/18 12:49:52 is Exp $"); +__RCSID("$NetBSD: getaddrinfo.c,v 1.121 2021/10/27 19:24:38 nia Exp $"); #endif /* LIBC_SCCS and not lint */ #ifndef RUMP_ACTION @@ -717,9 +717,8 @@ reorder(struct addrinfo *sentinel, struc return n; /* allocate a temporary array for sort and initialization of it. */ - if ((aio = malloc(sizeof(*aio) * n)) == NULL) + if ((aio = calloc(n, sizeof(*aio))) == NULL) return n; /* give up reordering */ - memset(aio, 0, sizeof(*aio) * n); /* retrieve address selection policy from the kernel */ TAILQ_INIT(&policyhead);