Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 May 2019 07:33:51 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r348354 - head/stand/libsa/zfs
Message-ID:  <201905290733.x4T7Xpdh018871@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tsoome
Date: Wed May 29 07:33:51 2019
New Revision: 348354
URL: https://svnweb.freebsd.org/changeset/base/348354

Log:
  loader: malloc+memset is calloc in spa_create
  
  Replace malloc + memset pair with calloc.

Modified:
  head/stand/libsa/zfs/zfsimpl.c

Modified: head/stand/libsa/zfs/zfsimpl.c
==============================================================================
--- head/stand/libsa/zfs/zfsimpl.c	Wed May 29 07:32:43 2019	(r348353)
+++ head/stand/libsa/zfs/zfsimpl.c	Wed May 29 07:33:51 2019	(r348354)
@@ -750,9 +750,8 @@ spa_create(uint64_t guid, const char *name)
 {
 	spa_t *spa;
 
-	if ((spa = malloc(sizeof(spa_t))) == NULL)
+	if ((spa = calloc(1, sizeof(spa_t))) == NULL)
 		return (NULL);
-	memset(spa, 0, sizeof(spa_t));
 	if ((spa->spa_name = strdup(name)) == NULL) {
 		free(spa);
 		return (NULL);



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