svn commit: r265367 - head/lib/libc/regex

Pedro F. Giffuni pfg at FreeBSD.org
Mon May 5 16:41:15 UTC 2014


Author: pfg
Date: Mon May  5 16:41:15 2014
New Revision: 265367
URL: http://svnweb.freebsd.org/changeset/base/265367

Log:
  regex: Use calloc instead of malloc.
  
  Mostly to reduce differences with OpenBSD.
  
  Obtained from:	OpenBSD (CVS rev. 1.17)
  MFC after:	3 days

Modified:
  head/lib/libc/regex/regcomp.c

Modified: head/lib/libc/regex/regcomp.c
==============================================================================
--- head/lib/libc/regex/regcomp.c	Mon May  5 16:35:37 2014	(r265366)
+++ head/lib/libc/regex/regcomp.c	Mon May  5 16:41:15 2014	(r265367)
@@ -214,7 +214,7 @@ regcomp(regex_t * __restrict preg,
 	if (g == NULL)
 		return(REG_ESPACE);
 	p->ssize = len/(size_t)2*(size_t)3 + (size_t)1;	/* ugh */
-	p->strip = (sop *)malloc(p->ssize * sizeof(sop));
+	p->strip = (sop *)calloc(p->ssize, sizeof(sop));
 	p->slen = 0;
 	if (p->strip == NULL) {
 		free((char *)g);


More information about the svn-src-head mailing list