Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 May 2017 23:57:09 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319015 - head/tools/regression/geom_gpt
Message-ID:  <201705272357.v4RNv9Vb078142@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sat May 27 23:57:09 2017
New Revision: 319015
URL: https://svnweb.freebsd.org/changeset/base/319015

Log:
  Use calloc instead of malloc + memset
  
  MFC after:	3 days
  Sponsored by:	Dell EMC Isilon

Modified:
  head/tools/regression/geom_gpt/gctl_test_helper.c

Modified: head/tools/regression/geom_gpt/gctl_test_helper.c
==============================================================================
--- head/tools/regression/geom_gpt/gctl_test_helper.c	Sat May 27 23:31:59 2017	(r319014)
+++ head/tools/regression/geom_gpt/gctl_test_helper.c	Sat May 27 23:57:09 2017	(r319015)
@@ -87,10 +87,9 @@ parse(char *arg, char **param, char **va
 			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?201705272357.v4RNv9Vb078142>