From 869e38fcdecda3de35d999b75fbaacc750fe3aaa Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 5 May 2020 13:45:06 +0200 Subject: ebtables: Free statically loaded extensions again All ebtables extensions are loaded upon program start as due to the lack of '-m' parameters, loading on demand is not possible. Introduce nft_fini_eb() to counteract nft_init_eb() and free dynamic memory in matches and targets from there. Signed-off-by: Phil Sutter --- iptables/xtables-eb.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'iptables/xtables-eb.c') diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c index 07ed6513..0df1345a 100644 --- a/iptables/xtables-eb.c +++ b/iptables/xtables-eb.c @@ -752,6 +752,23 @@ int nft_init_eb(struct nft_handle *h, const char *pname) return 0; } +void nft_fini_eb(struct nft_handle *h) +{ + struct xtables_match *match; + struct xtables_target *target; + + for (match = xtables_matches; match; match = match->next) { + free(match->m); + } + for (target = xtables_targets; target; target = target->next) { + free(target->t); + } + + free(opts); + + nft_fini(h); +} + int do_commandeb(struct nft_handle *h, int argc, char *argv[], char **table, bool restore) { -- cgit v1.2.3