svn commit: r245412 - head/usr.sbin/pkg
Baptiste Daroussin
bapt at FreeBSD.org
Mon Jan 14 07:17:39 UTC 2013
Author: bapt
Date: Mon Jan 14 07:17:38 2013
New Revision: 245412
URL: http://svnweb.freebsd.org/changeset/base/245412
Log:
Directly uses calloc(3) instread of malloc(3) + memset(3)
Reported by: Jeremy Chadwick <jdc at koitsu.org>
MFC after: 3 days
Modified:
head/usr.sbin/pkg/dns_utils.c
Modified: head/usr.sbin/pkg/dns_utils.c
==============================================================================
--- head/usr.sbin/pkg/dns_utils.c Mon Jan 14 05:52:23 2013 (r245411)
+++ head/usr.sbin/pkg/dns_utils.c Mon Jan 14 07:17:38 2013 (r245412)
@@ -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) {
More information about the svn-src-all
mailing list