Author: emaste Date: Tue May 2 19:56:42 2017 New Revision: 317700 URL: https://svnweb.freebsd.org/changeset/base/317700
Log: 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) 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 Tue May 2 19:30:42 2017 (r317699) +++ head/usr.bin/grep/regex/tre-fastmatch.c Tue May 2 19:56:42 2017 (r317700) @@ -630,7 +630,7 @@ tre_compile_fast(fastmatch_t *fg, const 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; _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"