From 1acebd57216e32d16ebb5684a6b2219e888997c3 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 26 Feb 2019 22:13:40 +0100 Subject: 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 Signed-off-by: Pablo Neira Ayuso --- src/parser_json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v1.2.3