summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/chain.c3
-rw-r--r--src/expr/log.c2
-rw-r--r--src/mxml.c4
-rw-r--r--src/rule.c4
-rw-r--r--src/set.c4
-rw-r--r--src/table.c2
6 files changed, 7 insertions, 12 deletions
diff --git a/src/chain.c b/src/chain.c
index e2296d3..97f6d95 100644
--- a/src/chain.c
+++ b/src/chain.c
@@ -597,7 +597,6 @@ static int nft_chain_xml_parse(struct nft_chain *c, char *xml)
goto err;
strncpy(c->name, name, NFT_CHAIN_MAXNAMELEN);
- xfree(name);
c->flags |= (1 << NFT_CHAIN_ATTR_NAME);
if (nft_mxml_num_parse(tree, "handle", MXML_DESCEND_FIRST, BASE_DEC,
@@ -650,8 +649,6 @@ static int nft_chain_xml_parse(struct nft_chain *c, char *xml)
goto err;
hooknum = nft_str2hooknum(hooknum_str);
- xfree(hooknum_str);
-
if (hooknum < 0)
goto err;
diff --git a/src/expr/log.c b/src/expr/log.c
index 14785fd..291502b 100644
--- a/src/expr/log.c
+++ b/src/expr/log.c
@@ -162,7 +162,7 @@ static int nft_rule_expr_log_xml_parse(struct nft_rule_expr *e, mxml_node_t *tre
if (prefix == NULL)
return -1;
- log->prefix = prefix;
+ log->prefix = strdup(prefix);
e->flags |= (1 << NFT_EXPR_LOG_PREFIX);
if (nft_mxml_num_parse(tree, "group", MXML_DESCEND_FIRST, BASE_DEC,
diff --git a/src/mxml.c b/src/mxml.c
index b5de153..b77936a 100644
--- a/src/mxml.c
+++ b/src/mxml.c
@@ -163,7 +163,7 @@ const char *nft_mxml_str_parse(mxml_node_t *tree, const char *node_name,
return NULL;
}
- return strdup(node->child->value.opaque);
+ return node->child->value.opaque;
}
int nft_mxml_family_parse(mxml_node_t *tree, const char *node_name,
@@ -177,8 +177,6 @@ int nft_mxml_family_parse(mxml_node_t *tree, const char *node_name,
return -1;
family = nft_str2family(family_str);
- xfree(family_str);
-
if (family < 0)
errno = EAFNOSUPPORT;
diff --git a/src/rule.c b/src/rule.c
index 4b5ffa6..c3cdb84 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -514,7 +514,7 @@ static int nft_rule_xml_parse(struct nft_rule *r, char *xml)
if (r->table)
xfree(r->table);
- r->table = table;
+ r->table = strdup(table);
r->flags |= (1 << NFT_RULE_ATTR_TABLE);
chain = nft_mxml_str_parse(tree, "chain", MXML_DESCEND_FIRST);
@@ -526,7 +526,7 @@ static int nft_rule_xml_parse(struct nft_rule *r, char *xml)
if (r->chain)
xfree(r->chain);
- r->chain = chain;
+ r->chain = strdup(chain);
r->flags |= (1 << NFT_RULE_ATTR_CHAIN);
if (nft_mxml_num_parse(tree, "handle", MXML_DESCEND_FIRST, BASE_DEC,
diff --git a/src/set.c b/src/set.c
index 97856b3..ff34bf5 100644
--- a/src/set.c
+++ b/src/set.c
@@ -328,7 +328,7 @@ static int nft_set_xml_parse(struct nft_set *s, char *xml)
if (s->name)
xfree(s->name);
- s->name = name;
+ s->name = strdup(name);
s->flags |= (1 << NFT_SET_ATTR_NAME);
table = nft_mxml_str_parse(tree, "table", MXML_DESCEND_FIRST);
@@ -338,7 +338,7 @@ static int nft_set_xml_parse(struct nft_set *s, char *xml)
if (s->table)
xfree(s->table);
- s->table = table;
+ s->table = strdup(table);
s->flags |= (1 << NFT_SET_ATTR_TABLE);
family = nft_mxml_family_parse(tree, "family", MXML_DESCEND_FIRST);
diff --git a/src/table.c b/src/table.c
index 1fa0dac..26bf60d 100644
--- a/src/table.c
+++ b/src/table.c
@@ -239,7 +239,7 @@ static int nft_table_xml_parse(struct nft_table *t, char *xml)
if (t->name)
xfree(t->name);
- t->name = name;
+ t->name = strdup(name);
t->flags |= (1 << NFT_TABLE_ATTR_NAME);
family = nft_mxml_family_parse(tree, "family", MXML_DESCEND_FIRST);