From owner-svn-src-head@FreeBSD.ORG Fri Jun 13 08:28:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D2693556; Fri, 13 Jun 2014 08:28:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFFDA2F84; Fri, 13 Jun 2014 08:28:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5D8Spv6071476; Fri, 13 Jun 2014 08:28:51 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5D8Sp7h071474; Fri, 13 Jun 2014 08:28:51 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201406130828.s5D8Sp7h071474@svn.freebsd.org> From: Tijl Coosemans Date: Fri, 13 Jun 2014 08:28:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267437 - head/lib/libc/iconv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jun 2014 08:28:51 -0000 Author: tijl Date: Fri Jun 13 08:28:51 2014 New Revision: 267437 URL: http://svnweb.freebsd.org/changeset/base/267437 Log: Replace malloc+memset with calloc. Modified: head/lib/libc/iconv/citrus_db_factory.c head/lib/libc/iconv/citrus_iconv.c Modified: head/lib/libc/iconv/citrus_db_factory.c ============================================================================== --- head/lib/libc/iconv/citrus_db_factory.c Fri Jun 13 08:26:53 2014 (r267436) +++ head/lib/libc/iconv/citrus_db_factory.c Fri Jun 13 08:28:51 2014 (r267437) @@ -270,11 +270,9 @@ _citrus_db_factory_serialize(struct _cit return (0); } /* allocate hash table */ - depp = malloc(sizeof(*depp) * df->df_num_entries); + depp = calloc(df->df_num_entries, sizeof(*depp)); if (depp == NULL) return (-1); - for (i = 0; i < df->df_num_entries; i++) - depp[i] = NULL; /* step1: store the entries which are not conflicting */ STAILQ_FOREACH(de, &df->df_entries, de_entry) { Modified: head/lib/libc/iconv/citrus_iconv.c ============================================================================== --- head/lib/libc/iconv/citrus_iconv.c Fri Jun 13 08:26:53 2014 (r267436) +++ head/lib/libc/iconv/citrus_iconv.c Fri Jun 13 08:28:51 2014 (r267437) @@ -344,9 +344,8 @@ const char { char *buf; - if ((buf = malloc((size_t)PATH_MAX)) == NULL) + if ((buf = calloc((size_t)PATH_MAX, sizeof(*buf))) == NULL) return (NULL); - memset((void *)buf, 0, (size_t)PATH_MAX); _citrus_esdb_alias(name, buf, (size_t)PATH_MAX); return (buf); }