summaryrefslogtreecommitdiffstats
path: root/src/mxml.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2013-08-14 11:10:58 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2013-08-14 11:14:11 +0200
commita5c387def7981fd5b2e48759d3d1ca489cdfefcf (patch)
tree91cdfee76d0c0abd7435fe4a0aac7a793f2e4670 /src/mxml.c
parent03886d5908fe4ba44a056d8297cc7b48c91a8f15 (diff)
src: xml: don't duplicate string in nft_table_xml_parse
With this patch, nft_table_xml_parse does not duplicate the string anymore, which is what most callers seem to need. This fixes memleaks in several places in the code. Thus, this patch also adapts the code to duplicate it when needed. Based on patch from Arturo Borrero. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/mxml.c')
-rw-r--r--src/mxml.c4
1 files changed, 1 insertions, 3 deletions
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;