How about this patch? Would you like to try and patch the other bugs you found?
2022-01-09 Alfred M. Szmidt <a...@gnu.org> * ifconfig/system/linux.c (system_parse_opt_set_txqlen) (linux_if_nameindex): Call xmalloc instead of malloc. diff --git a/ifconfig/system/linux.c b/ifconfig/system/linux.c index 5f914b88..8f3f0f4a 100644 --- a/ifconfig/system/linux.c +++ b/ifconfig/system/linux.c @@ -690,7 +690,7 @@ system_parse_opt_set_txqlen (struct ifconfig *ifp, char *arg) if (!(ifp->valid & IF_VALID_SYSTEM)) { - ifp->system = malloc (sizeof (struct system_ifconfig)); + ifp->system = xmalloc (sizeof (struct system_ifconfig)); if (!ifp->system) error (EXIT_FAILURE, errno, "can't get memory for system interface configuration"); @@ -945,7 +945,7 @@ linux_if_nameindex (void) } while (it); - idx = malloc (n * sizeof (*idx)); + idx = xmalloc (n * sizeof (*idx)); if (idx == NULL) { int saved_errno = errno;