bsdgrep: use safer sizeof() construct
Submitted by: Kyle Evans <kevans91@ksu.edu>
This commit is contained in:
parent
5cd267669a
commit
a6bc4f125a
@ -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