diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-06-10 16:45:48 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-06-15 13:26:33 +0200 |
commit | 50b175dbd598e80a0e67606645d1fa3c9be6ce01 (patch) | |
tree | bffe4211de5e4438a7c23514baa852bfa38e6fa0 /src/table.c | |
parent | 46b887ca6b0382d135599a83ed0884aeaf97a357 (diff) |
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 <pablo@netfilter.org>
Diffstat (limited to 'src/table.c')
-rw-r--r-- | src/table.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/table.c b/src/table.c index 412c6aa..32d119f 100644 --- a/src/table.c +++ b/src/table.c @@ -89,7 +89,7 @@ int nftnl_table_set_data(struct nftnl_table *t, uint16_t attr, switch (attr) { case NFTNL_TABLE_NAME: - if (t->name) + if (t->flags & (1 << NFTNL_TABLE_NAME)) xfree(t->name); t->name = strdup(data); @@ -227,7 +227,8 @@ int nftnl_table_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_table *t) return -1; if (tb[NFTA_TABLE_NAME]) { - xfree(t->name); + if (t->flags & (1 << NFTNL_TABLE_NAME)) + xfree(t->name); t->name = strdup(mnl_attr_get_str(tb[NFTA_TABLE_NAME])); if (!t->name) return -1; |