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 <j...@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) {
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to