svn commit: r288351 - head/lib/libc/gen

Xin LI delphij at FreeBSD.org
Tue Sep 29 04:47:32 UTC 2015


Author: delphij
Date: Tue Sep 29 04:47:31 2015
New Revision: 288351
URL: https://svnweb.freebsd.org/changeset/base/288351

Log:
  Use calloc() instead of malloc + memset.
  
  MFC after:	2 weeks

Modified:
  head/lib/libc/gen/fts-compat.c

Modified: head/lib/libc/gen/fts-compat.c
==============================================================================
--- head/lib/libc/gen/fts-compat.c	Tue Sep 29 03:40:21 2015	(r288350)
+++ head/lib/libc/gen/fts-compat.c	Tue Sep 29 04:47:31 2015	(r288351)
@@ -137,9 +137,8 @@ __fts_open_44bsd(char * const *argv, int
 	}
 
 	/* Allocate/initialize the stream. */
-	if ((priv = malloc(sizeof(*priv))) == NULL)
+	if ((priv = calloc(1, sizeof(*priv))) == NULL)
 		return (NULL);
-	memset(priv, 0, sizeof(*priv));
 	sp = &priv->ftsp_fts;
 	sp->fts_compar = compar;
 	sp->fts_options = options;


More information about the svn-src-head mailing list