svn commit: r318916 - head/usr.bin/grep/regex
Ed Maste
emaste at FreeBSD.org
Fri May 26 03:36:00 UTC 2017
Author: emaste
Date: Fri May 26 03:35:59 2017
New Revision: 318916
URL: https://svnweb.freebsd.org/changeset/base/318916
Log:
bsdgrep: use safer sizeof() construct
Submitted by: Kyle Evans <kevans91 at ksu.edu>
Modified:
head/usr.bin/grep/regex/tre-fastmatch.c
Modified: head/usr.bin/grep/regex/tre-fastmatch.c
==============================================================================
--- head/usr.bin/grep/regex/tre-fastmatch.c Fri May 26 03:27:06 2017 (r318915)
+++ head/usr.bin/grep/regex/tre-fastmatch.c Fri May 26 03:35:59 2017 (r318916)
@@ -351,7 +351,7 @@ static int fastcmp(const fastmatch_t *fg
#define FILL_BMGS \
if (fg->len > 0 && !fg->hasdot) \
{ \
- fg->sbmGs = malloc(fg->len * sizeof(int)); \
+ fg->sbmGs = malloc(fg->len * sizeof(*fg->sbmGs)); \
if (!fg->sbmGs) \
return REG_ESPACE; \
if (fg->len == 1) \
@@ -367,7 +367,7 @@ static int fastcmp(const fastmatch_t *fg
#define FILL_BMGS_WIDE \
if (fg->wlen > 0 && !fg->hasdot) \
{ \
- fg->bmGs = malloc(fg->wlen * sizeof(int)); \
+ fg->bmGs = malloc(fg->wlen * sizeof(*fg->bmGs)); \
if (!fg->bmGs) \
return REG_ESPACE; \
if (fg->wlen == 1) \
More information about the svn-src-head
mailing list