summaryrefslogtreecommitdiffstats
path: root/src/json.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2020-10-08 19:10:13 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2020-10-22 19:12:11 +0200
commit88af46df5544d9a0b080f23fb2902c86659f0c86 (patch)
tree742594253a96dc35d3df90f65a31ef642dd119ab /src/json.c
parentf1786e55b9ea0baa1357c0289b551407bf15b417 (diff)
json: Fix memleak in set_dtype_json()
Turns out json_string() already dups the input, so the temporary dup passed to it is lost. Fixes: e70354f53e9f6 ("libnftables: Implement JSON output support") Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/json.c b/src/json.c
index 121dfb24..a8824d3f 100644
--- a/src/json.c
+++ b/src/json.c
@@ -62,7 +62,7 @@ static json_t *set_dtype_json(const struct expr *key)
tok = strtok(namedup, " .");
while (tok) {
- json_t *jtok = json_string(xstrdup(tok));
+ json_t *jtok = json_string(tok);
if (!root)
root = jtok;
else if (json_is_string(root))