diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-06-10 15:07:13 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-06-15 13:26:32 +0200 |
commit | 46b887ca6b0382d135599a83ed0884aeaf97a357 (patch) | |
tree | 7e252be40ff5ba4b7978bc19228714cfef33df4d /src/rule.c | |
parent | 5b8ae79fae3bc8be9663bd752c7ec466a95ac180 (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.c | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -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: |