Use calloc instead of malloc + memset

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
This commit is contained in:
Enji Cooper 2017-05-27 23:57:09 +00:00
parent 9f825b1b1d
commit 73dcfb8ddc

View File

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