From 50b175dbd598e80a0e67606645d1fa3c9be6ce01 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 10 Jun 2016 16:45:48 +0200 Subject: src: check for flags before releasing attributes Now that unsetters don't set pointers to NULL, check if the attribute is set before trying to release it. Signed-off-by: Pablo Neira Ayuso --- src/expr/match.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/expr/match.c') diff --git a/src/expr/match.c b/src/expr/match.c index 2929b43..3342e2c 100644 --- a/src/expr/match.c +++ b/src/expr/match.c @@ -49,7 +49,7 @@ nftnl_expr_match_set(struct nftnl_expr *e, uint16_t type, mt->rev = *((uint32_t *)data); break; case NFTNL_EXPR_MT_INFO: - if (mt->data) + if (e->flags & (1 << NFTNL_EXPR_MT_INFO)) xfree(mt->data); mt->data = data; @@ -146,7 +146,7 @@ static int nftnl_expr_match_parse(struct nftnl_expr *e, struct nlattr *attr) uint32_t len = mnl_attr_get_payload_len(tb[NFTA_MATCH_INFO]); void *match_data; - if (match->data) + if (e->flags & (1 << NFTNL_EXPR_MT_INFO)) xfree(match->data); match_data = calloc(1, len); -- cgit v1.2.3