summaryrefslogtreecommitdiffstats
path: root/iptables/nft-cmd.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-cmd.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-cmd.c')
-rw-r--r--iptables/nft-cmd.c5
1 files changed, 1 insertions, 4 deletions
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)