Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jan 2013 07:17:39 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r245412 - head/usr.sbin/pkg
Message-ID:  <201301140717.r0E7HdEs078630@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301140717.r0E7HdEs078630>