[PATCH libnftnl 1/3] expr: immediate: check for chain attribute to release chain name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check for chain name attribute to release chain name, for consistency
with other existing attributes.

Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
 include/data_reg.h   |  2 --
 src/expr/data_reg.c  | 12 ------------
 src/expr/immediate.c |  4 ++--
 3 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/include/data_reg.h b/include/data_reg.h
index 5ee7080daef0..946354dc9881 100644
--- a/include/data_reg.h
+++ b/include/data_reg.h
@@ -35,8 +35,6 @@ int nftnl_data_reg_snprintf(char *buf, size_t size,
 struct nlattr;
 
 int nftnl_parse_data(union nftnl_data_reg *data, struct nlattr *attr, int *type);
-void nftnl_free_verdict(const union nftnl_data_reg *data);
-
 int nftnl_data_cpy(union nftnl_data_reg *dreg, const void *src, uint32_t len);
 
 #endif
diff --git a/src/expr/data_reg.c b/src/expr/data_reg.c
index 690b23dbad6c..d2ccf2e8dc68 100644
--- a/src/expr/data_reg.c
+++ b/src/expr/data_reg.c
@@ -206,18 +206,6 @@ int nftnl_parse_data(union nftnl_data_reg *data, struct nlattr *attr, int *type)
 	return ret;
 }
 
-void nftnl_free_verdict(const union nftnl_data_reg *data)
-{
-	switch(data->verdict) {
-	case NFT_JUMP:
-	case NFT_GOTO:
-		xfree(data->chain);
-		break;
-	default:
-		break;
-	}
-}
-
 int nftnl_data_cpy(union nftnl_data_reg *dreg, const void *src, uint32_t len)
 {
 	int ret = 0;
diff --git a/src/expr/immediate.c b/src/expr/immediate.c
index f56aa8fd6999..acc01a10154e 100644
--- a/src/expr/immediate.c
+++ b/src/expr/immediate.c
@@ -214,8 +214,8 @@ static void nftnl_expr_immediate_free(const struct nftnl_expr *e)
 {
 	struct nftnl_expr_immediate *imm = nftnl_expr_data(e);
 
-	if (e->flags & (1 << NFTNL_EXPR_IMM_VERDICT))
-		nftnl_free_verdict(&imm->data);
+	if (e->flags & (1 << NFTNL_EXPR_IMM_CHAIN))
+		xfree(imm->data.chain);
 }
 
 struct expr_ops expr_ops_immediate = {
-- 
2.30.2





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux