svn commit: r319015 - head/tools/regression/geom_gpt

Ngie Cooper ngie at FreeBSD.org
Sat May 27 23:57:10 UTC 2017


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);


More information about the svn-src-all mailing list