]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
nft: Use xtables_malloc() in mnl_err_list_node_add()
authorPhil Sutter <phil@nwl.cc>
Tue, 31 Aug 2021 10:26:20 +0000 (12:26 +0200)
committerPhil Sutter <phil@nwl.cc>
Tue, 31 Aug 2021 16:18:55 +0000 (18:18 +0200)
The function called malloc() without checking for memory allocation
failure. Simply replace the call by xtables_malloc() to fix that.

Fixes: 4e2020952d6f9 ("xtables: use libnftnl batch API")
Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/nft.c

index 795dff860540471f91b4aa23a17688ea8670b025..a470939db54fb4bf2c824e0a6831d215eb2f8064 100644 (file)
@@ -143,7 +143,7 @@ struct mnl_err {
 static void mnl_err_list_node_add(struct list_head *err_list, int error,
                                  int seqnum)
 {
-       struct mnl_err *err = malloc(sizeof(struct mnl_err));
+       struct mnl_err *err = xtables_malloc(sizeof(struct mnl_err));
 
        err->seqnum = seqnum;
        err->err = error;