summaryrefslogtreecommitdiffstats
path: root/src/rule.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2016-06-10 15:07:13 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2016-06-15 13:26:32 +0200
commit46b887ca6b0382d135599a83ed0884aeaf97a357 (patch)
tree7e252be40ff5ba4b7978bc19228714cfef33df4d /src/rule.c
parent5b8ae79fae3bc8be9663bd752c7ec466a95ac180 (diff)
src: simplify unsetters
If the attribute is set as we already check at the beginning of this function, then we can release the object. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/rule.c')
-rw-r--r--src/rule.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/rule.c b/src/rule.c
index 3ab29cf..bcc59a7 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -95,16 +95,10 @@ void nftnl_rule_unset(struct nftnl_rule *r, uint16_t attr)
switch (attr) {
case NFTNL_RULE_TABLE:
- if (r->table) {
- xfree(r->table);
- r->table = NULL;
- }
+ xfree(r->table);
break;
case NFTNL_RULE_CHAIN:
- if (r->chain) {
- xfree(r->chain);
- r->chain = NULL;
- }
+ xfree(r->chain);
break;
case NFTNL_RULE_HANDLE:
case NFTNL_RULE_COMPAT_PROTO: