From f404a63d34fddc8c9694f4a5dc7033e592b46c9d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 31 Jul 2021 12:58:51 -0700 Subject: [PATCH] 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. --- ChangeLog | 6 ++++++ tests/bench-digest.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index e35192a9e8..80bcabd227 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2021-07-31 Paul Eggert + + 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 xalloc: add malloc-related function attributes diff --git a/tests/bench-digest.h b/tests/bench-digest.h index 96a4499247..3ded94119e 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.39.5