summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2019-02-26 22:13:40 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2019-02-27 11:25:14 +0100
commit1acebd57216e32d16ebb5684a6b2219e888997c3 (patch)
tree8509a9ba0c0ed7ce6d5dec923d1c623200c24826
parentdc6a6e83b47fc7078a061350cd2b111cb2adec14 (diff)
parser_json: Use xstrdup() when parsing rule comment
Use xstrdup() instead of plain strdup() for consistency (and implicit ENOMEM checking). Fixes: 586ad210368b7 ("libnftables: Implement JSON parser") Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/parser_json.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/parser_json.c b/src/parser_json.c
index 78214f65..6755d39c 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -2461,7 +2461,7 @@ static struct cmd *json_parse_cmd_add_rule(struct json_ctx *ctx, json_t *root,
json_unpack(root, "{s:s}", "comment", &comment);
if (comment)
- rule->comment = strdup(comment);
+ rule->comment = xstrdup(comment);
json_array_foreach(tmp, index, value) {
struct stmt *stmt;