summaryrefslogtreecommitdiffstats
path: root/iptables/nft-bridge.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2021-08-31 12:29:43 +0200
committerPhil Sutter <phil@nwl.cc>2021-08-31 18:19:04 +0200
commite438b9766fcc86d9847312ff05f1d1dac61acf1f (patch)
tree2a7a550cd343caadb67a2e2331d533c56dc0f4da /iptables/nft-bridge.c
parentca11c7b7036b5821c17b8d08dc2a29f55b461a93 (diff)
nft: Use xtables_{m,c}alloc() everywhere
Make use of libxtables allocators where sensible to have implicit error checking. Leave library-internal calls in place to not create unexpected program exit points for users, apart from xt_xlate_alloc() as that function called xtables_error() in error case which exits by itself already. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/nft-bridge.c')
-rw-r--r--iptables/nft-bridge.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/iptables/nft-bridge.c b/iptables/nft-bridge.c
index d98fd527..11f3df35 100644
--- a/iptables/nft-bridge.c
+++ b/iptables/nft-bridge.c
@@ -477,11 +477,7 @@ static void nft_bridge_parse_lookup(struct nft_xt_ctx *ctx,
static void parse_watcher(void *object, struct ebt_match **match_list,
bool ismatch)
{
- struct ebt_match *m;
-
- m = calloc(1, sizeof(struct ebt_match));
- if (m == NULL)
- xtables_error(OTHER_PROBLEM, "Can't allocate memory");
+ struct ebt_match *m = xtables_calloc(1, sizeof(struct ebt_match));
if (ismatch)
m->u.match = object;