Directly uses calloc(3) instread of malloc(3) + memset(3)

Reported by:	Jeremy Chadwick <jdc@koitsu.org>
MFC after:	3 days
This commit is contained in:
Baptiste Daroussin 2013-01-14 07:17:38 +00:00
parent 10b4bb0b33
commit 8cc0ef19d2

View File

@ -66,10 +66,9 @@ dns_getsrvinfo(const char *zone)
p += len + NS_QFIXEDSZ;
}
res = malloc(sizeof(struct dns_srvinfo) * ancount);
res = calloc(ancount, sizeof(struct dns_srvinfo));
if (res == NULL)
return (NULL);
memset(res, 0, sizeof(struct dns_srvinfo) * ancount);
n = 0;
while (ancount > 0 && p < end) {