pf: Simplify cleanup
We can now counter_u64_free(NULL), so remove the checks. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29190
This commit is contained in:
parent
51dc8e7f68
commit
28dc2c954f
@ -624,9 +624,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags)
|
||||
cleanup_state: /* pf_state_insert() frees the state keys. */
|
||||
if (st) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (st->packets[i] != NULL)
|
||||
counter_u64_free(st->packets[i]);
|
||||
if (st->bytes[i] != NULL)
|
||||
counter_u64_free(st->bytes[i]);
|
||||
}
|
||||
if (st->dst.scrub)
|
||||
|
@ -707,9 +707,7 @@ pf_free_src_node(struct pf_ksrc_node *sn)
|
||||
{
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (sn->bytes[i])
|
||||
counter_u64_free(sn->bytes[i]);
|
||||
if (sn->packets[i])
|
||||
counter_u64_free(sn->packets[i]);
|
||||
}
|
||||
uma_zfree(V_pf_sources_z, sn);
|
||||
@ -1739,9 +1737,7 @@ pf_free_state(struct pf_state *cur)
|
||||
cur->timeout));
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (cur->bytes[i] != NULL)
|
||||
counter_u64_free(cur->bytes[i]);
|
||||
if (cur->packets[i] != NULL)
|
||||
counter_u64_free(cur->packets[i]);
|
||||
}
|
||||
|
||||
|
@ -256,9 +256,7 @@ pf_kkif_free(struct pfi_kkif *kif)
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
for (int k = 0; k < 2; k++) {
|
||||
if (kif->pfik_packets[i][j][k])
|
||||
counter_u64_free(kif->pfik_packets[i][j][k]);
|
||||
if (kif->pfik_bytes[i][j][k])
|
||||
counter_u64_free(kif->pfik_bytes[i][j][k]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user