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 <[email protected]>

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)                                               \
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to