From: Paul Eggert Date: Sat, 31 Jul 2021 19:58:51 +0000 (-0700) Subject: maint: pacify GCC 11.2 -fanalyzer in crypto tests X-Git-Tag: v1.0~2763 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=f404a63d34fddc8c9694f4a5dc7033e592b46c9d;p=gnulib.git 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. --- 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. */ {