]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Silence "potential null pointer dereference" warnings.
authorBruno Haible <bruno@clisp.org>
Sat, 3 Jun 2023 11:56:37 +0000 (13:56 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 4 Jun 2023 13:54:10 +0000 (15:54 +0200)
Pinpointed by gcc 13 warning:
warning: potential null pointer dereference [-Wnull-dereference]

* gettext-tools/src/xg-arglist-context.c: Include verify.h.
(flag_context_list_table_add): Assert that the entry is non-NULL.

gettext-tools/src/xg-arglist-context.c

index 14f37cb5f54b8c16db2efa6f84ae89b512b0b372..f89a4be3d6e268dd9ea30c5998c002cbbd7dcb7a 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "xalloc.h"
 #include "xmalloca.h"
+#include "verify.h"
 
 
 /* Null context.  */
@@ -179,6 +180,9 @@ flag_context_list_table_add (flag_context_list_table_ty *table,
       }
     else
       {
+        /* We don't put NULL entries into the table.  */
+        assume (entry != NULL);
+
         flag_context_list_ty *list = (flag_context_list_ty *)entry;
         flag_context_list_ty **lastp = NULL;
         /* Invariant: list == (lastp != NULL ? *lastp : entry).  */