Author: kevans
Date: Thu Aug 17 17:13:15 2017
New Revision: 322624
URL: https://svnweb.freebsd.org/changeset/base/322624

Log:
  MFC r318916: bsdgrep: use safer sizeof() construct
  
  Approved by:  emaste (mentor, blanket MFC)

Modified:
  stable/11/usr.bin/grep/regex/tre-fastmatch.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/grep/regex/tre-fastmatch.c
==============================================================================
--- stable/11/usr.bin/grep/regex/tre-fastmatch.c        Thu Aug 17 17:11:59 
2017        (r322623)
+++ stable/11/usr.bin/grep/regex/tre-fastmatch.c        Thu Aug 17 17:13:15 
2017        (r322624)
@@ -351,7 +351,7 @@ static int  fastcmp(const fastmatch_t *fg, const void *
 #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, const void *
 #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)                                               \
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to