From e438b9766fcc86d9847312ff05f1d1dac61acf1f Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 31 Aug 2021 12:29:43 +0200 Subject: 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 --- iptables/nft-bridge.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'iptables/nft-bridge.c') 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; -- cgit v1.2.3