Do not do the useless job for an empty table.

MFC after:	1 month
This commit is contained in:
Roman Kurakin 2008-09-20 15:54:22 +00:00
parent 3aeb70f799
commit 03d4b38d9e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=183205

View file

@ -5937,6 +5937,11 @@ table_handler(int ac, char *av[])
l = sizeof(a);
if (do_cmd(IP_FW_TABLE_GETSIZE, &a, (uintptr_t)&l) < 0)
err(EX_OSERR, "getsockopt(IP_FW_TABLE_GETSIZE)");
/* If a is zero we have nothing to do, the table is empty. */
if (a == 0)
return;
l = sizeof(*tbl) + a * sizeof(ipfw_table_entry);
tbl = malloc(l);
if (tbl == NULL)