If batch_rule_add() failed (ENOMEM), nft_rule_append() frees the
rule and then tries to add it to the rule cache. Better return 0
(failure) instead of continuing.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
} else
type = NFT_COMPAT_RULE_APPEND;
- if (batch_rule_add(h, type, r) < 0)
+ if (batch_rule_add(h, type, r) < 0) {
nftnl_rule_free(r);
+ return 0;
+ }
if (verbose)
h->ops->print_rule(r, 0, FMT_PRINT_RULE);