Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Directly use calloc instead of malloc + memset
Baptiste Daroussin committed 13 years ago
commit 972fa42b1d81a9ad68b21618c7f40e351f396033
parent e0c1682
1 file changed +1 -2
modified libpkg/dns_utils.c
@@ -65,10 +65,9 @@ dns_getsrvinfo(const char *zone)
		p += len + NS_QFIXEDSZ;
	}

-
	res = malloc(sizeof(struct dns_srvinfo) * ancount);
+
	res = calloc(1, sizeof(struct dns_srvinfo) * ancount);
	if (res == NULL)
		return (NULL);
-
	memset(res, 0, sizeof(struct dns_srvinfo) * ancount);

	n = 0;
	while (ancount > 0 && p < end) {