svn commit: r245609 - stable/9/usr.sbin/pkg

Baptiste Daroussin bapt at FreeBSD.org
Fri Jan 18 17:49:01 UTC 2013


Author: bapt
Date: Fri Jan 18 17:49:00 2013
New Revision: 245609
URL: http://svnweb.freebsd.org/changeset/base/245609

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

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

Modified: stable/9/usr.sbin/pkg/dns_utils.c
==============================================================================
--- stable/9/usr.sbin/pkg/dns_utils.c	Fri Jan 18 17:48:10 2013	(r245608)
+++ stable/9/usr.sbin/pkg/dns_utils.c	Fri Jan 18 17:49:00 2013	(r245609)
@@ -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-stable-9 mailing list