bsdgrep: use safer sizeof() construct
Submitted by: Kyle Evans <kevans91@ksu.edu>
This commit is contained in:
parent
85a9cb4440
commit
6068d3b2c9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=318916
@ -351,7 +351,7 @@ static int fastcmp(const fastmatch_t *fg, const void *data,
|
||||
#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 *data,
|
||||
#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) \
|
||||
|
Loading…
Reference in New Issue
Block a user