bsdgrep: use calloc where appropriate in grep's tre-fastmatch
Also apply style(9) to a related NULL check. Submitted by: Kyle Evans <kevans91 at ksu.edu> (D10098)
This commit is contained in:
parent
2f86d4b001
commit
e0780d5479
@ -630,7 +630,7 @@ tre_compile_fast(fastmatch_t *fg, const tre_char_t *pat, size_t n,
|
||||
if (escaped)
|
||||
{
|
||||
if (!_escmap)
|
||||
_escmap = malloc(n * sizeof(bool));
|
||||
_escmap = calloc(n, sizeof(bool));
|
||||
if (!_escmap)
|
||||
{
|
||||
free(tmp);
|
||||
@ -714,8 +714,8 @@ badpat:
|
||||
{
|
||||
if (fg->wescmap != NULL)
|
||||
{
|
||||
fg->escmap = malloc(fg->len * sizeof(bool));
|
||||
if (!fg->escmap)
|
||||
fg->escmap = calloc(fg->len, sizeof(bool));
|
||||
if (fg->escmap != NULL)
|
||||
{
|
||||
tre_free_fast(fg);
|
||||
return REG_ESPACE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user