Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 May 2017 02:56:37 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r319170 - stable/10/tools/regression/geom_gpt
Message-ID:  <201705300256.v4U2ubo8047317@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Tue May 30 02:56:37 2017
New Revision: 319170
URL: https://svnweb.freebsd.org/changeset/base/319170

Log:
  MFC r319015:
  
  Use calloc instead of malloc + memset

Modified:
  stable/10/tools/regression/geom_gpt/gctl_test_helper.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/tools/regression/geom_gpt/gctl_test_helper.c
==============================================================================
--- stable/10/tools/regression/geom_gpt/gctl_test_helper.c	Tue May 30 02:56:17 2017	(r319169)
+++ stable/10/tools/regression/geom_gpt/gctl_test_helper.c	Tue May 30 02:56:37 2017	(r319170)
@@ -87,10 +87,9 @@ parse(char *arg, char **param, char **value, int *len)
 			return (EINVAL);
 		if (*len <= 0 || *len > PATH_MAX)
 			return (EINVAL);
-		*value = malloc(*len);
+		*value = calloc(*len, sizeof(char));
 		if (*value == NULL)
 			return (ENOMEM);
-		memset(*value, 0, *len);
 		if (equal != NULL) {
 			if (strlen(equal) >= PATH_MAX)
 				return (ENOMEM);



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