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,10 +624,8 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags)
|
|||||||
cleanup_state: /* pf_state_insert() frees the state keys. */
|
cleanup_state: /* pf_state_insert() frees the state keys. */
|
||||||
if (st) {
|
if (st) {
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (st->packets[i] != NULL)
|
counter_u64_free(st->packets[i]);
|
||||||
counter_u64_free(st->packets[i]);
|
counter_u64_free(st->bytes[i]);
|
||||||
if (st->bytes[i] != NULL)
|
|
||||||
counter_u64_free(st->bytes[i]);
|
|
||||||
}
|
}
|
||||||
if (st->dst.scrub)
|
if (st->dst.scrub)
|
||||||
uma_zfree(V_pf_state_scrub_z, st->dst.scrub);
|
uma_zfree(V_pf_state_scrub_z, st->dst.scrub);
|
||||||
|
@ -707,10 +707,8 @@ pf_free_src_node(struct pf_ksrc_node *sn)
|
|||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (sn->bytes[i])
|
counter_u64_free(sn->bytes[i]);
|
||||||
counter_u64_free(sn->bytes[i]);
|
counter_u64_free(sn->packets[i]);
|
||||||
if (sn->packets[i])
|
|
||||||
counter_u64_free(sn->packets[i]);
|
|
||||||
}
|
}
|
||||||
uma_zfree(V_pf_sources_z, sn);
|
uma_zfree(V_pf_sources_z, sn);
|
||||||
}
|
}
|
||||||
@ -1739,10 +1737,8 @@ pf_free_state(struct pf_state *cur)
|
|||||||
cur->timeout));
|
cur->timeout));
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (cur->bytes[i] != NULL)
|
counter_u64_free(cur->bytes[i]);
|
||||||
counter_u64_free(cur->bytes[i]);
|
counter_u64_free(cur->packets[i]);
|
||||||
if (cur->packets[i] != NULL)
|
|
||||||
counter_u64_free(cur->packets[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pf_normalize_tcp_cleanup(cur);
|
pf_normalize_tcp_cleanup(cur);
|
||||||
|
@ -256,10 +256,8 @@ pf_kkif_free(struct pfi_kkif *kif)
|
|||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
for (int j = 0; j < 2; j++) {
|
for (int j = 0; j < 2; j++) {
|
||||||
for (int k = 0; k < 2; k++) {
|
for (int k = 0; k < 2; k++) {
|
||||||
if (kif->pfik_packets[i][j][k])
|
counter_u64_free(kif->pfik_packets[i][j][k]);
|
||||||
counter_u64_free(kif->pfik_packets[i][j][k]);
|
counter_u64_free(kif->pfik_bytes[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