svn commit: r245608 - stable/8/usr.sbin/pkg

Baptiste Daroussin bapt at FreeBSD.org
Fri Jan 18 17:48:11 UTC 2013


Author: bapt
Date: Fri Jan 18 17:48:10 2013
New Revision: 245608
URL: http://svnweb.freebsd.org/changeset/base/245608

Log:
  MFC: r245412
  Directly uses calloc(3) instread of malloc(3) + memset(3)
  
  Reported by:	Jeremy Chadwick <jdc at koitsu.org>

Modified:
  stable/8/usr.sbin/pkg/dns_utils.c
Directory Properties:
  stable/8/usr.sbin/pkg/   (props changed)

Modified: stable/8/usr.sbin/pkg/dns_utils.c
==============================================================================
--- stable/8/usr.sbin/pkg/dns_utils.c	Fri Jan 18 16:32:33 2013	(r245607)
+++ stable/8/usr.sbin/pkg/dns_utils.c	Fri Jan 18 17:48:10 2013	(r245608)
@@ -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