a2ea441692
- Install an improved sample config - Fix permissions of osf-related configs - rule: Fix for potential off-by-one in cmd_add_loc() - netlink_delinearize: Fix suspicious calloc() call - netlink: Avoid memleak in error path of netlink_delinearize_obj() - netlink: Avoid memleak in error path of netlink_delinearize_table() - netlink: Avoid memleak in error path of netlink_delinearize_chain() - netlink: Avoid memleak in error path of netlink_delinearize_set() - json: Drop pointless assignment in exthdr_expr_json() - evaluate: Mark fall through case in str2hooknum() - parser_json: Fix for memleak in tcp option error path - parser_bison: Fix for implicit declaration of isalnum - main: fix nft --help output fallout from 719e4427 - tests: add icmp/6 test where dependency should be left alone - payload: check icmp dependency before removing previous icmp expression Resolves: rhbz#1933117, rhbz#1938823, rhbz#1931790, rhbz#1964987, rhbz#1971600
43 lines
1.4 KiB
Diff
43 lines
1.4 KiB
Diff
From 2344a35f90ef4a467b6bb9779fc687b17f4a4b51 Mon Sep 17 00:00:00 2001
|
|
From: Phil Sutter <phil@nwl.cc>
|
|
Date: Fri, 11 Jun 2021 16:43:21 +0200
|
|
Subject: [PATCH] netlink: Avoid memleak in error path of
|
|
netlink_delinearize_set()
|
|
|
|
Duplicate string 'comment' later when the function does not fail
|
|
anymore.
|
|
|
|
Fixes: 0864c2d49ee8a ("src: add comment support for set declarations")
|
|
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
(cherry picked from commit accd7a346fd19f1ffc503b3f681323abf1157c1a)
|
|
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
---
|
|
src/netlink.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/netlink.c b/src/netlink.c
|
|
index ec2dad29ace1c..5c38a9f157d38 100644
|
|
--- a/src/netlink.c
|
|
+++ b/src/netlink.c
|
|
@@ -840,7 +840,7 @@ struct set *netlink_delinearize_set(struct netlink_ctx *ctx,
|
|
if (ud[NFTNL_UDATA_SET_DATA_TYPEOF])
|
|
typeof_expr_data = set_make_key(ud[NFTNL_UDATA_SET_DATA_TYPEOF]);
|
|
if (ud[NFTNL_UDATA_SET_COMMENT])
|
|
- comment = xstrdup(nftnl_udata_get(ud[NFTNL_UDATA_SET_COMMENT]));
|
|
+ comment = nftnl_udata_get(ud[NFTNL_UDATA_SET_COMMENT]);
|
|
}
|
|
|
|
key = nftnl_set_get_u32(nls, NFTNL_SET_KEY_TYPE);
|
|
@@ -878,7 +878,7 @@ struct set *netlink_delinearize_set(struct netlink_ctx *ctx,
|
|
set->handle.set.name = xstrdup(nftnl_set_get_str(nls, NFTNL_SET_NAME));
|
|
set->automerge = automerge;
|
|
if (comment)
|
|
- set->comment = comment;
|
|
+ set->comment = xstrdup(comment);
|
|
|
|
init_list_head(&set_parse_ctx.stmt_list);
|
|
|
|
--
|
|
2.31.1
|
|
|