* tests/bench-digest.h (main): Report an error after memory exhaustion, instead of using a null pointer. --- ChangeLog | 6 ++++++ tests/bench-digest.h | 5 +++++ 2 files changed, 11 insertions(+)
diff --git a/ChangeLog b/ChangeLog index e35192a9e..80bcabd22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2021-07-31 Paul Eggert <egg...@cs.ucla.edu> + + maint: pacify GCC 11.2 -fanalyzer in crypto tests + * tests/bench-digest.h (main): Report an error after memory + exhaustion, instead of using a null pointer. + 2021-07-30 Paul Eggert <egg...@cs.ucla.edu> xalloc: add malloc-related function attributes diff --git a/tests/bench-digest.h b/tests/bench-digest.h index 96a449924..3ded94119 100644 --- a/tests/bench-digest.h +++ b/tests/bench-digest.h @@ -82,6 +82,11 @@ main (int argc, char *argv[]) int repeat = atoi (argv[2]); char *memblock = (char *) malloc (size); + if (!memblock) + { + fprintf (stderr, "%s: memory exhausted\n", argv[0]); + return 1; + } /* Fill the memory block. */ { -- 2.31.1