From bae7b4d283826efbeb28c21aecd7b355e86da170 Mon Sep 17 00:00:00 2001 From: "Sebastian Walz (sivizius)" Date: Mon, 19 Aug 2024 20:11:44 +0200 Subject: parser_json: fix several expression memleaks from error path Fixes: 586ad210368b ("libnftables: Implement JSON parser") Signed-off-by: Sebastian Walz (sivizius) Signed-off-by: Pablo Neira Ayuso Conflict:delete change about json_parse_optstrip_stmt Reference:https://git.netfilter.org/nftables/commit/?id=bae7b4d283826efbeb28c21aecd7b355e86da170 --- src/parser_json.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/parser_json.c b/src/parser_json.c index fc20fe29..8ca44efb 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -1308,6 +1308,7 @@ static struct expr *json_parse_range_expr(struct json_ctx *ctx, expr_high = json_parse_primary_expr(ctx, high); if (!expr_high) { json_error(ctx, "Invalid high value in range expression."); + expr_free(expr_low); return NULL; } return range_expr_alloc(int_loc, expr_low, expr_high); @@ -1889,6 +1890,8 @@ static struct stmt *json_parse_mangle_stmt(struct json_ctx *ctx, return stmt; default: json_error(ctx, "Invalid mangle statement key expression type."); + expr_free(key); + expr_free(value); return NULL; } } -- cgit v1.2.3