diff options
author | Phil Sutter <phil@nwl.cc> | 2024-01-31 21:40:19 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2024-02-01 14:51:30 +0100 |
commit | d109e41344b8f54741c0862a44d544a713178dd3 (patch) | |
tree | 5990f301d536ff6977aa5be83c9f32889fcf2177 /iptables/xtables.c | |
parent | 933e605154c439218f73f48b028abbeed336c3c5 (diff) |
xshared: Introduce xtables_clear_args()
Perform struct xtables_args object deinit in a common place, even though
it merely consists of freeing any IP addresses and masks.
This fixes for a memleak in arptables-translate as the check for
h->family didn't catch the value NFPROTO_ARP.
Fixes: 5b7324e0675e3 ("nft-arp: add arptables-translate")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/xtables.c')
-rw-r--r-- | iptables/xtables.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/iptables/xtables.c b/iptables/xtables.c index 22d6ea58..5d73481c 100644 --- a/iptables/xtables.c +++ b/iptables/xtables.c @@ -264,10 +264,7 @@ int do_commandx(struct nft_handle *h, int argc, char *argv[], char **table, h->ops->clear_cs(&cs); - free(args.s.addr.ptr); - free(args.s.mask.ptr); - free(args.d.addr.ptr); - free(args.d.mask.ptr); + xtables_clear_args(&args); xtables_free_opts(1); return ret; |