From 46b887ca6b0382d135599a83ed0884aeaf97a357 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 10 Jun 2016 15:07:13 +0200 Subject: 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 --- src/rule.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/rule.c') 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: -- cgit v1.2.3