Blame SOURCES/0017-netlink-fix-memory-leak.patch

4f6fcd
From f1bb0c6263ca11bedea9e18bc9753c6b1d4c924d Mon Sep 17 00:00:00 2001
4f6fcd
From: Ivan Vecera <cera@cera.cz>
4f6fcd
Date: Thu, 24 Sep 2020 20:10:31 +0200
4f6fcd
Subject: [PATCH 17/17] netlink: fix memory leak
4f6fcd
4f6fcd
Potentially allocated memory allocated for mask is not freed when
4f6fcd
the allocation for value fails.
4f6fcd
4f6fcd
Fixes: 81a30f416ec7 ("netlink: add bitset command line parser handlers")
4f6fcd
4f6fcd
Cc: Michal Kubecek <mkubecek@suse.cz>
4f6fcd
Signed-off-by: Ivan Vecera <cera@cera.cz>
4f6fcd
---
4f6fcd
 netlink/parser.c | 4 +++-
4f6fcd
 1 file changed, 3 insertions(+), 1 deletion(-)
4f6fcd
4f6fcd
diff --git a/netlink/parser.c b/netlink/parser.c
4f6fcd
index c5a368a65a7a..3b25f5d5a88e 100644
4f6fcd
--- a/netlink/parser.c
4f6fcd
+++ b/netlink/parser.c
4f6fcd
@@ -630,8 +630,10 @@ static int parse_numeric_bitset(struct nl_context *nlctx, uint16_t type,
4f6fcd
 	}
4f6fcd
 
4f6fcd
 	value = calloc(nwords, sizeof(uint32_t));
4f6fcd
-	if (!value)
4f6fcd
+	if (!value) {
4f6fcd
+		free(mask);
4f6fcd
 		return -ENOMEM;
4f6fcd
+	}
4f6fcd
 	ret = __parse_num_string(arg, len1, value, force_hex1);
4f6fcd
 	if (ret < 0) {
4f6fcd
 		parser_err_invalid_value(nlctx, arg);
4f6fcd
-- 
4f6fcd
2.26.2
4f6fcd