33 lines
1.1 KiB
Diff
33 lines
1.1 KiB
Diff
From 6cbc04136a91eca237476827b57e78ac29e00aeb Mon Sep 17 00:00:00 2001
|
|
From: Phil Sutter <phil@nwl.cc>
|
|
Date: Fri, 11 Jun 2021 18:32:13 +0200
|
|
Subject: [PATCH] netlink: Avoid memleak in error path of
|
|
netlink_delinearize_chain()
|
|
|
|
If parsing udata fails, 'chain' has to be freed before returning to
|
|
caller.
|
|
|
|
Fixes: 702ac2b72c0e8 ("src: add comment support for chains")
|
|
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
(cherry picked from commit 04f7af9dd66d3a0f627f43bc4bf55bae9856efc8)
|
|
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
---
|
|
src/netlink.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/src/netlink.c b/src/netlink.c
|
|
index 5c38a9f157d38..22140afc3fd7e 100644
|
|
--- a/src/netlink.c
|
|
+++ b/src/netlink.c
|
|
@@ -573,6 +573,7 @@ struct chain *netlink_delinearize_chain(struct netlink_ctx *ctx,
|
|
udata = nftnl_chain_get_data(nlc, NFTNL_CHAIN_USERDATA, &ulen);
|
|
if (nftnl_udata_parse(udata, ulen, chain_parse_udata_cb, ud) < 0) {
|
|
netlink_io_error(ctx, NULL, "Cannot parse userdata");
|
|
+ chain_free(chain);
|
|
return NULL;
|
|
}
|
|
if (ud[NFTNL_UDATA_CHAIN_COMMENT])
|
|
--
|
|
2.31.1
|
|
|