aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/grep/regex/tre-fastmatch.c
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2017-05-02 19:56:42 +0000
committerEd Maste <emaste@FreeBSD.org>2017-05-02 19:56:42 +0000
commite0780d5479352349bd96ff9c084d28e62e9e4294 (patch)
tree6e278b8e34fc50259db9b76f1d897d6ad761ee58 /usr.bin/grep/regex/tre-fastmatch.c
parent2f86d4b001113148f224b0e3366133da4fa61493 (diff)
downloadsrc-e0780d5479352349bd96ff9c084d28e62e9e4294.tar.gz
src-e0780d5479352349bd96ff9c084d28e62e9e4294.zip
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)
Notes
Notes: svn path=/head/; revision=317700
Diffstat (limited to 'usr.bin/grep/regex/tre-fastmatch.c')
-rw-r--r--usr.bin/grep/regex/tre-fastmatch.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/grep/regex/tre-fastmatch.c b/usr.bin/grep/regex/tre-fastmatch.c
index 3e5394caf959..da242842a0d3 100644
--- a/usr.bin/grep/regex/tre-fastmatch.c
+++ b/usr.bin/grep/regex/tre-fastmatch.c
@@ -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;