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-cmd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'iptables/nft-cmd.c') diff --git a/iptables/nft-cmd.c b/iptables/nft-cmd.c index a0c76a79..87e66905 100644 --- a/iptables/nft-cmd.c +++ b/iptables/nft-cmd.c @@ -23,10 +23,7 @@ struct nft_cmd *nft_cmd_new(struct nft_handle *h, int command, struct nftnl_rule *rule; struct nft_cmd *cmd; - cmd = calloc(1, sizeof(struct nft_cmd)); - if (!cmd) - return NULL; - + cmd = xtables_calloc(1, sizeof(struct nft_cmd)); cmd->command = command; cmd->table = xtables_strdup(table); if (chain) -- cgit v1.2.3