Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 May 2014 16:41:15 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r265367 - head/lib/libc/regex
Message-ID:  <201405051641.s45GfFje086423@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405051641.s45GfFje086423>