]> Savannah Git Hosting - gnulib.git/commitdiff
maint: pacify GCC 11.2 -fanalyzer in crypto tests
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 31 Jul 2021 19:58:51 +0000 (12:58 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 31 Jul 2021 19:59:25 +0000 (12:59 -0700)
* tests/bench-digest.h (main): Report an error after memory
exhaustion, instead of using a null pointer.

ChangeLog
tests/bench-digest.h

index e35192a9e88dbc2e50e6ff1ccc660c2734822590..80bcabd22739b29c087ee0d6fac02e5a3896811b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-07-31  Paul Eggert  <eggert@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  <eggert@cs.ucla.edu>
 
        xalloc: add malloc-related function attributes
index 96a44992478ffbdfcea634ee4471a4fc8cdee1fb..3ded94119e71b54475e0613caf81184bf982864f 100644 (file)
@@ -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.  */
   {